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
精彩评论