开发者

datetime('now') gives wrong time

The System-Time of my Android emulator is correct (currently 13:42). But when i use the datetime('now')-function to set the current time in my SQLite Database, the returned value is wrong (11:42).

Is there another time i need to set to get this working corre开发者_StackOverflowctly?


The return value of datetime('now') is in UTC.

Try

datetime('now', 'localtime')


datetime('now') will return in GMT UTC - which you probably should do then handle the conversion to your local timezone in the app. If you keep it in UTC in the database, then convert it in your activities, your app will work correctly as the user moves around timezones

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜