List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:March 28 2002 1:15am
Subject:Re: unix_timesamp function out by a day when using a different
timezone
View as plain text  
>  >Description:
>After setting the TZ environment variable to a different timezone, then
>using the UNIX_TIMESTAMP(...) function on a mysql timestamp string 
>brings back the correct time, but a date that is a day out, but only 
>for certain dates. It seems that the date becomes the original date 
>plus the difference in the timezones. Only the date is affected - 
>not the time. Ie if the new timezone is +5 hours difference, then it 
>will add 5 hours to the timestamp, use that date, then use the 
>original time of the timestamp.
>Since a timestamp is a timestamp, it should not be affected by the 
>timezone when displaying it.

They're stored in GMT but converted to the server's timezone for display.

>  >How-To-Repeat:
>1. create a timestamp in the database
>2. using a select statement, apply the UNIX_TIMESTAMP function to 
>the timestamp
>3. change the TZ environment var to another timezone
>4. using a select statement, apply the UNIX_TIMESTAMP function to 
>the timestamp
>
>repeat these steps for each of the 24 hours in the day for the 
>original timestamp, and you will see that some of them will have 
>different dates.

Thread
unix_timesamp function out by a day when using a different timezoneDominic Gamble28 Mar
  • Re: unix_timesamp function out by a day when using a differenttimezonePaul DuBois28 Mar
    • Re: unix_timesamp function out by a day when using a differenttimezoneDominic Gamble28 Mar