开发者

Sqlite couldn't show the correct current time

开发者 https://www.devze.com 2023-04-06 02:54 出处:网络
I have set my time as US Locale.I have made database in Sqlite.In database i have fields like Entry_Date which set as CURRENT_TIMESTAMP..Now i run query like

I have set my time as US Locale.I have made database in Sqlite.In database i have fields like Entry_Date which set as CURRENT_TIMESTAMP..Now i run query like

   SELECT time('now')

o/p:  06:22:09

It display wrong time.so my que开发者_如何学运维stion is How do i set the Sqlite time?


You need to pass the localtime modifier to the time function.

sqlite> select time('now','localtime');
06:38:51

See Date and Time Functions

Update: For the record, here's how to output a unix epoch date:

sqlite> select time(1316638370,'unixepoch','localtime');
06:52:50
0

精彩评论

暂无评论...
验证码 换一张
取 消