Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am a bit confused about using dates/times along with timezones in WordPress. I have the following questions:

  1. What is the purpose of the timezone setting in the Admin -> Settings section?

  2. Assume current time in GMT is 20:00, and Assume I am in EST (so it is 16:00 in EST time), how is the time of the blog saved?

  3. Assume a reader is reading the post, and he/she is located in Turkey. So their local time is 23:00, do they see 23:00 as the post time?

  4. Assume I am using a custom post type, and I am having an extra date/time field for other date information. How do I ensure that the custom date field behaves as the WordPress field?

I apologize for those basic questions, but I really need your help explaining those.

share|improve this question

2 Answers 2

"Your blog’s timezone is set to Coordinated Universal Time, UTC by default, which is in London, UK. If you live in a different area of the world you will likely want to change this option." - http://en.support.wordpress.com/settings/general-settings/

The posts are saved in the UTC format.

Users will see the time the post time as the time the post was created in relation to the blog settings not their local time.

I'm not understanding your final point entirely but you can code what custom fields do using the functions.php file in the wordpress template. - http://codex.wordpress.org/Custom_Fields

http://codex.wordpress.org/Function_Reference/current_time

share|improve this answer

One: Purpose of the timezone setting in the Admin -> Settings section?
Two: How is the time of the blog saved?

To set your local time, use the wp-admin » Settings - Timezone. As a comment there is saying: "Choose a city in the same timezone as you." For each of the blogpost there are two fields in the database: post_date and post_date_gmt. So whenever you save a post or save a draft of a post, it takes both the time - the local time and the GMT. The local time (post_date) is generated by the setting you make into the Settings - Timezone.

Three: Do the users see their local time into the post-time?

As the post is saved with both of the time (UTC & your local time), so the post will be viewed with the date&time of yours, not theirs, if your Settings do so.

Four: How do I ensure that the custom date field behaves like the WordPress field?

If your custom field is simply <input type="date"/>, I hope it will work with your local time; if that is <input type="datetime"/> then it'll generate an UTC time, if that is <input type="datetime-local"/> then it will allow you to select your local time. But to me both of the last two options are same.
And for your kind understanding: a custom field works like a string. So whatever you input into the field will be the thing you will get from it. Just ensure the thing exactly what you want into the field, it'll return the same. (More on WordPress Custom Fields)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.