WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form DB
[resolved] CFDB Time Zone Issue (20 posts)

  1. Gillian
    Member
    Posted 1 year ago #

    Hi Michael

    I have a website being hosted overseas and I am having a problem with the date/timestamp on entries to the database captured by CFDB from a CF7 form.

    The server time zone is UTC while the MySQL timezone is set to my local timezone (UTC+11) and the WordPress General Options timezone is also set to local time (UTC+11). The hosting company does not want to change the server time zone because that will affect all domains hosted there.

    My difficulty is that CFDB entries are being date/timestamped in server (UTC) date/time instead of local time.

    Is there an easy way I can get the CFDB records' "Submitted" field date/timestamped in the database with my local time, at the point when they are first recorded (i.e. I don't want to edit the Submitted field)?

    Thanks in advance :-)

    http://wordpress.org/extend/plugins/contact-form-7-to-database-extension/

  2. Michael Simpson
    Member
    Plugin Author

    Posted 1 year ago #

    You can change the WordPress timezone in the Admin -> General settings. I think the plugin pulls the timezone settings from that (I'd have to check to be sure). If you set WP to the TZ you want, does that work?

  3. Gillian
    Member
    Posted 1 year ago #

    Hi Michael

    Thanks for the speedy reply :-)

    As noted in my original post, I already have my WordPress timezone in Admin > General Settings set to UTC+11. The problem is that the timezone being used by CFDB is UTC+0 (i.e. GMT) which is the server timezone.

  4. Michael Simpson
    Member
    Plugin Author

    Posted 1 year ago #

    I missed that. I can't think of anything else you can do to change the timezone of the submit time.

  5. Gillian
    Member
    Posted 1 year ago #

    Would it be possible for me to make a change to the plug-in code for the submit time to be pulled from the WordPress timezone instead of the server timezone? I would think I'm not the only one experiencing this issue.

  6. Michael Simpson
    Member
    Plugin Author

    Posted 1 year ago #

    You would have to replace various
    date_default_timezone_set(get_option('timezone_string'));
    lines in the code with the timezone you want. It's not configurable right now.

  7. Gillian
    Member
    Posted 1 year ago #

    Hi Michael

    If you could possibly tell me which plug-in files I'd need to edit I'll give it a go.

    Many thanks.

  8. Gillian
    Member
    Posted 1 year ago #

    Hi Michael

    Just reporting back that I have resolved the problem, and the database entries are now correctly recorded in local time.

    Thanks for your help.

  9. lassiebun
    Member
    Posted 1 year ago #

    I am having the same issue. Gillian, can you please respond with the step you took to fixed this?

    Thanks,

    Karla

  10. Michael Simpson
    Member
    Plugin Author

    Posted 1 year ago #

    I added a way to set this in the Database Options panel. I just need to push out an update of the plugin. Will do later today

  11. lassiebun
    Member
    Posted 1 year ago #

    Michael,

    Thank you so much for adding this option. It is greatly appreciated and my client is super pleased!

    Keep up the great work!

    Karla

  12. jodzeee
    Member
    Posted 1 year ago #

    I'm confused. I found the option to change it, but it says if left blank, it will pull from the timezone set in WordPress. Is that not true?

  13. Michael Simpson
    Member
    Plugin Author

    Posted 1 year ago #

    That is the expected behavior. Be sure there are no blank spaces in that field.

  14. jodzeee
    Member
    Posted 1 year ago #

    I'm not sure we're talking about the same thing. The field is blank by default and the text says, "Timezone to capture Submit Time. Blank will use WordPress Timezone setting."

    But that's not how it works. If I leave it blank, it's not giving me the right time.

    screen-grab

  15. Michael Simpson
    Member
    Plugin Author

    Posted 1 year ago #

    You are saying that it is not giving the correct time, but you are not saying what it is actually giving you. If blank, it should be giving you the time in the timezone set in Setting -> General -> Timezone. If you don't get that, what do you get?

  16. jodzeee
    Member
    Posted 1 year ago #

    Sorry ... if I leave it blank, the time it's outputting is 5 hours ahead. It's 12:50 here now, but when I fill out a form and look in the DB, it says 17:50.

  17. Michael Simpson
    Member
    Plugin Author

    Posted 1 year ago #

    And what is the setting in Settings -> General -> Timezone ?

  18. jodzeee
    Member
    Posted 1 year ago #

    Oh man! I'm so sorry. I didn't have that set right, it was UTC-6. I thought I had checked that but I think because I saw the "local time is ..." and the time format in the right time that I had it set.

    Thank you for being so helpful and for the quick response. I really appreciate it!

  19. REMAS100
    Member
    Posted 1 year ago #

    As noted in my original post, I already have my WordPress timezone in [link to non-WordPress site moderated] Admin > General Settings set to UTC+11. The problem is that the timezone being used by CFDB is UTC+0 (i.e. GMT) which is the server timezone.

  20. jodzeee
    Member
    Posted 1 year ago #

    Can you set it to a city? I set mine to Chicago and it works great. It even changed the previous entries to the correct time.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic