Page 1 of 1

DateTime is displayed in GMT instead of localtime...

Posted: Wed 08 Jan 2014 01:53
by Steven
Using LiteDAC 2.2.5 with Delphi Xe2

I'm modifying an app and having an issue where SQLite DateTime fields are being displayed in GMT instead of localtime.
It does this whether I have LiteDAC connected 'direct' or not.

How do I fix it so that the localtime is what is displayed when retrieving the field data (for example for use in a label) or when displayed in a DBGrid?

UPDATE:
I've got a better understanding of what's going on.
The dates are not being recorded as local DateTime because the database covers several timezones so what is showing is correct. However for the enduser interface I need to be able to display the datetime info in the localtime format.

Re: DateTime is displayed in GMT instead of localtime...

Posted: Thu 09 Jan 2014 13:07
by AlexP
Hello,

To display date as localtime, you can explicitly map the field to localtime in the query, for example:

Code: Select all

select datetime(date('now'), 'localtime')