Keith Devens .com |
Tuesday, August 19, 2008 | ![]() |
| That which yields, is not always weak. – Jacqueline Carey (Kushiel's Dart) | ||
|
| ← 'Show' function for debugging in PHP | Powerpuff girls e-mail address? → |

jason wrote:
Keith (http://keithdevens.com/) wrote:
Well, here's one reason. I'd like to know what time things were done in my localtime. Given daylight savings time, if I only store GMT, I won't really know what time, localtime, things were done unless I also check to see if DST was in effect in code.
Another example is that if I move to a different time zone I'd like to have my new blog times change to my new localtime but leave the old ones the same.
One of the things that's kind of freaking me out is this: my permalinks are based on my localtime posting. The official date for this post is July 15 and that's the date in the permalink. If I was in Sri Lanka (or wherever), my post might have been on July 16th. What if it's May 1 here and I travel to a different time zone and post something on April 30 (their) localtime? It makes me want to organize my weblog only according to GMT to avoid stuff like that, but then it won't reflect what time I'm actually living in.
Being able to treat MySQL dates as dates and storing them in datetime format like WordPress does is looking more and more attractive.
Keith (http://keithdevens.com/) wrote:
Here's someone else thinking along these lines:
http://www.gyford.com/phil/writing/2003/08/21/movable_type_tim.php
Daylight savings time is another, smaller, issue.
Keith (http://keithdevens.com/) wrote:
Here's a neat post that seems worth mentioning.
Matt (http://photomatt.net/) wrote:
We struggled with this quite a bit and had a couple of failed attempts before we came up with the current method in WP. I'm pretty happy with the robustness of the data and the way it makes it easy to work with things. However our reliance on the MySQL date functions makes the WordPress application very hard to port to other databases.
Keith (http://keithdevens.com/) wrote:
Thanks Matt. I'm most likely going to follow your lead here. I probably wouldn't have thought of doing it that way if I hadn't seen WordPress do it first. Incidentally, when I was writing this post I looked back on your reply to the e-mail I sent you asking about this. Thanks for all the insight.
And, portability is much more of a concern for you with WP because it's software that other people use. My software's just for me so I have the luxury of not worrying about hassles like portability if I don't want to. 
Keith (http://keithdevens.com/) wrote:
It appears Dunstan has used the same scheme in the new version of his weblog (search for "Post times").
161.142.148.211 wrote:
I'm hosting mysql outside of my country and my question how do I store date into database for current date + date into the database but using my country current time, and my country localtime is GMT+8
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):
Generated in about 0.158s.
(Used 8 db queries)

I wouldn't bother storing the timezone unless there was a good reason. Store the UTC time, and then apply the timezone of the user viewing the dates/times.
If you wrote something at 3pm localtime, do I care. If I am 3hours ahead it might be nicer to see that you wrote it at 6pm my localtime. If I was comparing lots of different events by people in different timezones, having things in my local timezone would be nicer than seeing what time each individual did things in their timezone.