On 9/1/08, jonwood <[EMAIL PROTECTED]> wrote:
>
>  Okay, I give up. I've been searching for a while now. I've found a number of
>  discussions about how CURRENT_DATE returns the date in UTC, and that it can
>  be converted to local time. But I've yet to find one article that clearly
>  states how one might do this.
>
>  I would love to have a table column default to the current date, but I want
>  it to be the date where the computer is located, rather than some far off
>  place.
>
>  Can anyone tell me if this is possible?

Don't think it is possible. As you noted, the docs say very clearly
(http://www.sqlite.org/lang_createtable.html) -- " The DEFAULT
constraint specifies a default value to use when doing an INSERT. ..
default value may also be one of the special case-independant keywords
CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP. ... If the value is
CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP, then the current UTC
date and/or time is inserted into the columns. "

So, you can store only UTC date/time, but you can always convert on
retrieving the values by using datetime('now', 'localtime')

One thing to note -- the UTC date/time doesn't seem to account for
daylight savings adjustment. For example, I am right now in Washington
DC where it is 10:30 PM. It is 3:30 AM in the UK right now, but per
SQLite (the UTC bit), it is 2:30 AM. I guess I have to do all this
adjustment in my queries and application.


>
>  Thanks.
>
> --
>  View this message in context: 
> http://www.nabble.com/Default-Column-Value-to-Local-Time-tp19263208p19263208.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
>


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to