Brandon Fosdick wrote:
> sqlite> select date('1220302462','unixepoch');
> 2008-09-01
> sqlite> select date('1220249914','unixepoch');
> 2008-09-01
>
Unix times contain no time zone information (they are relative to an
epoch in the UTC time zone), and SQLite's date/time functions return
values in the UTC time zone by default:
sqlite> select datetime('1220302462','unixepoch');
2008-09-01 20:54:22
sqlite> select datetime('1220249914','unixepoch');
2008-09-01 06:18:34
But you can make them return values in the local time zone with the
|localtime| modifier:
sqlite> select datetime('1220302462','unixepoch', 'localtime');
2008-09-01 13:54:22
sqlite> select datetime('1220249914','unixepoch', 'localtime');
2008-08-31 23:18:34
> The MySQL version is correct in the sense that it returns dates/times
> that correspond to what my clock said when I created the records that
> contain the timestamps in question.
That's just a coincidence. MySQL's from_unixtime
<http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_from-unixtime>
returns values in the "current time zone," so if you'd changed zones
since inserting the records, it would show you different values.
-myk
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users