sqlite3中时间函数
datetime()/datetime('now')显示的是零时区的时间,"YYYY-MM-DD HH:MM:SS" 如果要获得当前时区的可以 datetime('now','localtime') 如果知道是哪个时区的:datetime('now','-3 hours') 其它的时间函数:(摘自官网)
ExamplesCompute the current date.
SELECT date('now'); Compute the last day of the current month. SELECT date('now','start of month','+1 month','-1 day'); Compute the date and time given a unix timestamp 1092941466. SELECT datetime(1092941466,'unixepoch'); Compute the date and time given a unix timestamp 1092941466,and compensate for your local timezone. Compute the current unix timestamp.SELECT strftime('%s','now'); |