DateTime is displayed in GMT instead of localtime...

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Steven
Posts: 30
Joined: Fri 06 Dec 2013 19:48

DateTime is displayed in GMT instead of localtime...

Post by Steven » Wed 08 Jan 2014 01:53

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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

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

Post by AlexP » Thu 09 Jan 2014 13:07

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')

Post Reply