[yunqa.de] Re: Question about UTC and local time

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Sun, 06 Jul 2008 11:02:34 +0200

Hello Edwin Yip,

>Thank you Jerry, I noticed that without the 'localtime' modifier, the 'now' 
>modifier will return the UTC time, not my local time.

Correct. I would choose the UTC time format for data storage. This means that 
all dates and times in the database are in a single time zone only. It 
simplifies time comparisons and calculations, especially if you access the 
database from or move it accross different time zones.

For user interaction (time entry and display), convert between 'localtime' and 
'utc' according to the computer's time zone as you store or retrieve data. You 
can do so with the help of the DISQLite3 build-in SQL functions, or the Windows 
API, for example:

  * GetTimeZoneInformation
  * FileTimeToLocalFileTime 
  * LocalFileTimeToFileTime

Related helper functions in the DISQLite3Api unit are:

  * FileTimeToJulianDate()
  * JulianDateToFileTime()

Ralf 

_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: