On Wed, Jun 27, 2012 at 05:45:41PM +0200, deltagam...@gmx.net scratched on the wall: > Am 27.06.2012 17:40, schrieb Jay A. Kreibich: > >On Wed, Jun 27, 2012 at 05:37:55PM +0200, deltagam...@gmx.net scratched on > >the wall: > > > >>Hello, > >> > >>>sqlite3 event.db "select datetime('now')"; > >>gives me a time that is 2 hours too late ( 2012-06-27 15:33:13) > >>than my system time ( win 7 ) 17::33:13 > >> > >>How can this be fixed ? > > Move two timezones to the west. > > > > (By default all times and dates are UTC.)
> I use this from within a c++ application > char create_sql[] = "CREATE TABLE if not exists eventlog (" > "id INTEGER PRIMARY KEY," > "eventdate DATETIME default current_timestamp," > "eventtype TEXT," > ")"; > > How do I get the right time in the the column eventdate ? UTC is "the right time." If you're doing anything with dates and times I would STRONGLY recommend that all recorded times are in UTC. Anything online and anything mobile tends to be used from different timezones. As for converting to the local time for display purposes, see: http://sqlite.org/lang_datefunc.html In specific, the "localtime" modifier. > How to move timezones ? Car, usually. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users