sqlite3 timestamp (current_timestamp) one hour off
Posted
by
Eiriks
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Eiriks
Published on 2012-12-19T16:28:36Z
Indexed on
2012/12/19
17:13 UTC
Read the original article
Hit count: 381
I run a small crawler on a virtual ubuntu server, initiated by crontab hourly. Datetime is inserted by defaulting the date filed to TIMESTAMP DEFAULT CURRENT_TIMESTAMP
.
Table creation looks like this:
CREATE TABLE links (page TEXT, link TEXT, date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY(page,link));
The datetime gets stored fine, but it one hour off (one hour behind) Norwegian time (GMT +1). The server is located where-ever, I just need it to be on GMT+1.
By typing date
in the ssh session I get:
Wed Dec 19 17:26:02 CET 2012
and that is correct (just now).
So where does sqlite3 get it's time from? What must I do to set the time so that sqlite3 gets the time right?
© Ask Ubuntu or respective owner