[thelist] Why use UTC time?

Erik Mattheis gozz at gozz.com
Mon Feb 24 14:59:45 CST 2003


On Monday, February 24, 2003, at 01:47  PM, shawn allen wrote:
> quoth Erik Mattheis:
>> What's the advantage for having unix epoch times always in GMT if your
>> app is hosted in a single time zone? Seems useless to me. Nay,
>> detrimental.
>
> The UNIX epoch /is/ midnight GMT. Storing time vales relative to
> differing timezones on individual files or machines would kinda defeat
> the purpose of having a standard, wouldn't it?

I would agree in general ... but not for the purpose of what I want to
do. When I use PHP's date('Y-m-d H:i',0) it interprets 0 as local time
- 1969-12-31 18:00 ... is this the expected behavior? I'd rather
something come out of MySQL as I put it in there instead of adjusting
it for GMT and then any adjustments the app requires on top of that ...
but I get the feeling I'm making things more complicated then they
should be ...

My desired behavior:

User enters 2/24/2003 6:00 pm in CST, date is stored as seconds since
midnight, 1/1/1970, and can be displayed as that same time in any
timezone the user chooses ... like if they're in EST, it would display
as 7 pm. Seems to me that could be taken care of in less than four
short lines of code ... but I don't see it.

>  the TZ environment variable determines
> the output of time(), mktime(), date(), etc. To change your timezone,
> simply change the environment variable:
>
> putenv('TZ=US/Pacific');

[...]

Lots of info to digest, but it seems like my answer is definitely in
there somewhere. Thanks!

For the record, if you can't tell, I'm just getting into PHP/MySQL,
trying to make use of time serving jury duty, which mainly consists of
doing nothing except being prepared to be immediately and indefinitely
unavailable.
-----------------------
Erik Mattheis
GoZz Digital
<http://goZz.com/>
Flash and ColdFusion Development
Minneapolis, MN
-----------------------




More information about the thelist mailing list