开发者

SQLite - current_timestamp doesn't return the right hour?

开发者 https://www.devze.com 2023-01-17 13:00 出处:网络
In the SQLite IDE SQL window, I\'ve written the instruction to return the the equivalence of .NET DateTime.Now, which is CURRENT_TIMESTAMP.

In the SQLite IDE SQL window, I've written the instruction to return the the equivalence of .NET DateTime.Now, which is CURRENT_TIMESTAMP.

Let's say it is开发者_如何学JAVA 10:47:00 in local time, that is, GMT -4:00 (on summertime), otherwise it is GMT -5:00.

The result of my query:

select current_timestamp

returns 2010-09-23 14:47:00, regardless of my local machine time.

How can I make SQLite use my local time instead of GMT?

Thanks everyone! =)


Use select datetime(current_timestamp, 'localtime');

You can get more info on the date/time functions here

0

精彩评论

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