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

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Sat, 05 Jul 2008 13:56:11 +0200

Edwin Yip wrote:

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

The "utc" modifier is the exact opposite of "localtime". While "localtime" 
modifier adjusts a time string so that it displays the correct local time,  
"utc" undoes this, so that a local time string displays in "utc".

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

Just the other way round as you do when retrieving a TDateTime value:

  Stmt.Column_Double(idx) := DateTimeToJulianDate(Now);

Ralf 

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



Other related posts: