前言
- sqlite
CURRENT_TIMESTAMP
默认输出UTC
时间, 输出UTC+8
如下
建表语句
-
CREATE TABLE
sss
(f_id INT(11) NOT NULL, f_start TIMESTAMP NOT NULL, f_end TIMESTAMP NOT NULL,f_create_time TIMESTAMP NOT NULL DEFAULT(datetime(CURRENT_TIMESTAMP, 'localtime'))
, PRIMARY KEY (f_id)); -
datetime(CURRENT_TIMESTAMP, ‘localtime’)
可以默认当前时区的时间也就是 utc+8
查询 utc+8
- SELECT (datetime(update_time, ‘localtime’)) FROM sqlite WHERE (datetime(CURRENT_TIMESTAMP, ‘localtime’)) >= xxx