
DateTime timezone truncation problems
Reported by Dan Kubb (dkubb) | May 4th, 2008 @ 01:55 AM
MySQL does not store timezones for any date, datetime or timestamp fields. The problem is that when you pull the value out of the Database it comes out in the UTC timezone, while the year/month/day/hour/minute/second are the same as the original input. So basically the timezone is changed to UTC.
I'm not precisely sure what the solution is, but I was thinking that the DateTime object should be converted to UTC timezone prior to insertion. That way at least the input and output would be equivalent, and you could always convert the output to the original time zone, to get a precise match.
When I say convert, I mean actually calculate the offset from UTC and add/subtract the right number of minutes from the DateTime object.
I'm not sure if this change should be done at the dm-core or dataobjects layer.
Comments and changes to this ticket
-
Dan Kubb (dkubb) May 4th, 2008 @ 01:55 AM
When this ticket is completed, please uncomment the following pending spec:
-
Dan Kubb (dkubb) May 4th, 2008 @ 01:58 AM
Also please uncomment the following pending spec when completed:
-
Sam Smoot May 7th, 2008 @ 12:28 PM
- Assigned user set to Scott Bauer
-
-
Scott Bauer May 8th, 2008 @ 07:07 PM
- State changed from new to resolved
Fixed. Mysql's only notion of Timezone is the one its running under. It assumes that the time being inserted is for the current locale's timezone, but stores the date in UTC. The DO Driver assumes that Mysql has given us the date rolled forward/backward from UTC to the current timezone, so we're just creating the date with the current timezone applied.
See http://github.com/sam/do/commit/... for details.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »