MySQL Forums
Forum List  »  General

Re: Probable timezone problems: can anyone confirm and offer a solution?
Posted by: Ted Byers
Date: March 22, 2014 03:51PM

Rick James Wrote:
-------------------------------------------------------
> > And my perl code takes the current timestamp,
> using the local timezone and converts it to UTC
> before trying to store it.
>
> Smells like a double conversion!
>
> The bits on disk that represent a TIMESTAMP
> datatype are UTC. But what you feed to a
> TIMESTAMP column (via INSERT) will be converted by
> MySQL on the fly, based on the timezone setting.
>
Damn! I am feeding UTC timestamps to mysql, and because mysql presently thnks the timezone is EST/EDT, it converts that to UTC (so the values end up being offset an additional 5 hours. Right? That would suggest that if I didn't provide a timestamp, and instead just used the function 'NOW()',

> Granted, if you tell MySQL that your "local time"
> is UTC _and_ my.ini says UTC, then that Perl code
> is the 'right' thing to do. (I suggest is it the
> 'wrong' way to get the right answer.)

I am guessing that you'd be recommending using NOW() instead of Perl, to handle the current timestamp, with it's timezone. And I suppose that would make it unnecessary to change the timezone that MySQL thinks applies. Right?

Thanks

Ted

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.