On 6/21/05, Sebastian wrote:
> i never understand why people use datetime anyway.. unix timestamp is so
> much easier to work with.
Unix epoch is by definition UTC. Sometimes I want to work with dates
in some local timezone. In other databases that have a more complete
implementation of the SQL standard you can do really neat tricks with
that. Just look at the following examples from PostgreSQL:
jochemd=> select '2005-06-15 00:00:00';
?column?
------------------------
2005-06-15 00:00:00
jochemd=> select '2005-06-15 00:00:00' AT TIME ZONE 'PDT';
timezone
---------------------
2005-06-14 17:00:00
jochemd=> set TimeZone = 'EST';
jochemd=> select '2005-06-15 00:00:00';
?column?
---------------------
2005-06-15 00:00:00
jochemd=> select '2005-06-15 00:00:00' AT TIME ZONE 'PDT';
timezone
---------------------
2005-06-14 22:00:00
While I can't use this functionality in MySQL (yet?), I use it enough
in other databases to always use a timestamp datatype instead of a
epoch to keep code as uniform as possible.
Jochem
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]