In an effort to share some hard-won insight:

I used to store local times in the database, but it's a bad idea and I got
bit.  Think about what gets stored: A number of seconds/nanoseconds/whatever
from some time in the past (Jan 1, 1970 for example).  When daylight savings
arrives, all of your stored values are now off by an hour (and if they're
around midnight, they're on the wrong date too).  And times you save now
will similarly be off when you leave day light savings.  It's much better to
store UTC and then convert to local time as needed.

I (and some customers) went through a lot of pain as I switched everything
to UTC -- life has been good since then.

Doug



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:sqlite-users-
> [EMAIL PROTECTED] On Behalf Of jonwood
> Sent: Monday, October 20, 2008 9:03 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] CURRENT_DATE Behavior
> 
> 
> 
> D. Richard Hipp wrote:
> >
> > CREATE TABLE whatever(
> >      ....
> >      timestamp DATE DEFAULT (datetime('now','localtime')),
> >      ...
> > );
> >
> 
> Really? I can do that? Great!
> 
> Thanks!
> --
> View this message in context: http://www.nabble.com/CURRENT_DATE-
> Behavior-tp20075044p20082173.html
> Sent from the SQLite mailing list archive at Nabble.com.
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to