Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

datetime('now') gives wrong time

Tags:

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 correctly?

like image 394
Lukas Knuth Avatar asked May 22 '11 11:05

Lukas Knuth


People also ask

How accurate is DateTime now in C#?

It tends to be between 0.5 and 15 milliseconds. As a result, repeated calls to the Now property in a short time interval, such as in a loop, may return the same value.

Is DateTime Now local time?

The property Now of the DateTime class returns the current date and time of the machine running the code, expressed in the computer's local time. The property UtcNow of the DateTime class returns the current date and time of the machine running the code, expressed in UTC format.

What is DateTime value?

The DateTime value type represents dates and times with values ranging from 00:00:00 (midnight), January 1, 0001 Anno Domini (Common Era) through 11:59:59 P.M., December 31, 9999 A.D. (C.E.) in the Gregorian calendar. Time values are measured in 100-nanosecond units called ticks.


1 Answers

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

Try

datetime('now', 'localtime') 
like image 117
Mike Sherrill 'Cat Recall' Avatar answered Sep 19 '22 15:09

Mike Sherrill 'Cat Recall'