Sqlite: CURRENT_TIMESTAMP is in GMT, not the timezone of the machine

Posted by BrianH on Stack Overflow See other posts from Stack Overflow or by BrianH
Published on 2008-12-19T15:53:32Z Indexed on 2010/05/30 15:12 UTC
Read the original article Hit count: 362

Filed under:
|
|
|

I have a sqlite (v3) table with this column definition:

"timestamp" DATETIME DEFAULT CURRENT_TIMESTAMP

The server that this database lives on is in the CST time zone. When I insert into my table without including the timestamp column, sqlite automatically populates that field with the current timestamp in GMT, not CST.

Is there a way to modify my insert statement to force the stored timestamp to be in CST? On the other hand, it is probably better to store it in GMT (in case the database gets moved to a different timezone, for example), so is there a way I can modify my select SQL to convert the stored timestamp to CST when I extract it from the table?

Thanks in advance!

© Stack Overflow or respective owner

Related posts about sql

Related posts about sqlite