[yunqa.de] Question about UTC and local time

  • From: "Edwin Yip" <mindvisualizer@xxxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Sat, 5 Jul 2008 19:27:28 +0800

Hello Ralf,

I am a bit confused by the UTC time and localtime. Is it all date time
values in SQLIE are treated as UTC?

In my PC which the time zone is UTC + 8, by executing the following SQL at
this moment:

select datetime('now') as f1, datetime('now', 'localtime') as f2,
datetime('now', 'utc') as f3

I got the following values:
f1 = 2008-07-05 11:21:08
f2 = 2008-07-05 19:21:08
f3 = 2008-07-05 03:21:08

I don't understand why f1 is not equal f3?

If I have a value in Delphi which is of type TDateTime and equals to Delphi
function Now(). How to store this value to the DB correcty?

The above questions maybe are a little confusing but that's because I'm
confusing :(

Best Regards,

Edwin Yip

Other related posts: