Times, Localization, and Entry Dates
One of the hardest areas of web applications to get your head around is the treatment of dates across various timezones, servers, and computers with daylight savings time (DST). There are so many variables that ExpressionEngine can never be 100% sure of the proper time, and often the only answer is to experiment. The wiki article Dates Explained may help in this.
Here’s the problem with time. Imagine you and your buddies are trying to meet up at a set time, and you’ve all given me your watches so I can phone you at exactly 7 to tell you to be there. When I get your watches, some of them are set 1 hour behind everyone elses (DST). OK, confusing, but as long as I know that are observing DST I can account for this. Now imagine that each one is set for a different time zone. OK, also confusing, but I can figure that out also. Now suddenly some of the watches stop observing DST (many hosts do), or start observing at different times. Now I’m scratching my head. I get a bunch of new watches, and I don’t know if they are observing DST or not. Now some of the watches are simply set to the wrong time. There’s also a master watch with the official time used for each day you want to meet your friends, and every day there’s a new way of officially adding and removing that hour.
Here’s how I have my system setup to give me accurate time on EngineHosting. I’m in Toronto, so Eastern Standard Time. Both my personal local time (under My Account > Localization) and my system time (Admin > System Preferences> Localization Settings) are set to Eastern time. My “Daylight Saving Time” and also my “Honor the Daylight Saving Time setting associated with each weblog entry?” are set to “no”. Partly this is to avoid the DST problem all together, but also I had originally set it this way as I was moving between hosts, and wanted fine control without needing to worry about what setup they had. Without DST, this puts me an hour “behind”, so I set my “Server Offset (in minutes)” to 60 to make up for it.
When I post, the date and time under “date” is the exact same as my local time, and it posts to screen with that time. When DST ends, I’ll probably have to go in and remove that server offset.
If you wanted the time an entry was posted without any reference to the localization of the author, {gmt_entry_date} is what you want.
The date the entry was submitted in GMT. This variable is not localized for each user’s date settings.
Category: How do I find..., Customization, Technical Issues, Troubleshooting
