Re: Time-Zone juggling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Giragosian wrote:
On 11/8/06, Travis Doherty <travis@xxxxxxxxxxx> wrote:

David Giragosian wrote:

> Does Daylight Savings alter Zulu time? (I'm guessing "yes"). How did the
> military deal with that?
>
> I use a date-time field as a primary key in db tables that get an
> insert a
> minute. I had to jump through a number of hoops to turn off DST on the
> (RH
> Linux) server.
>
> David
>
UTC (or GMT, or Zulu, or Z) does not observe Daylight Savings Time.  In
any database that you store timestamps and need to know exactly what
that timestamp means you should use UTC, then use application logic to
translate to the users time zone.

Another option would be to store epoch time (seconds since the OS's
epoch) and work the same result from that, I prefer storing
human-readable timestamps even if you have to do the datemath in your
head to read them in your own timezone.  Epoch does not count
leap-seconds like UTC so it can be off by a tiny bit at any given time.
Epoch time also differs on different operating systems - Unix is
1970-01-01 at 00:00:00 UTC, Windows seems to use 1601-01-01 at 00:00:00
UTC... I don't know if that would ever matter though - I imagine the
database server would mask this and the application would port to
windows without problems (no idea.)

UTC has no DST from: http://en.wikipedia.org/wiki/Time_zone
>>
Due to daylight saving time, UTC is local time at the Royal Observatory,
Greenwich <http://en.wikipedia.org/wiki/Royal_Observatory%2C_Greenwich>
only between 01:00 UTC on the last Sunday in October and 01:00 UTC on
the last Sunday in March. For the rest of the year, local time there is
UTC+1 <http://en.wikipedia.org/wiki/UTC%2B1>, known in the United
Kingdom <http://en.wikipedia.org/wiki/United_Kingdom> as British Summer
Time <http://en.wikipedia.org/wiki/British_Summer_Time> (BST). Similar
circumstances apply in many places.
<<
**
Travis Doherty
TixTime


We are using now() in the MySQL db to insert current time. Database version
is 4.0.24.

I see that in 4.1.* there is utc_timestamp().
Anybody know if this function avoids DST? Might be worth the hassle of
upgrade and possible code changes in the PHP scripts to obtain this feature.
<< Shudder >>

Thanks,

David


you don't quite understand what UTC is, do you :)
UTC doesn't have DST. It just doesn't, at all.
If it returns a timestamp in UTC offset, it will "avoid" DST for you...

- tul

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux