Lazarus

Free Pascal => General => Topic started by: MikeFinch on September 25, 2021, 02:26:57 am

Title: now() returning UTO rather than local (system) date/time
Post by: MikeFinch on September 25, 2021, 02:26:57 am
I am using Mageia 8. Whilst checking my programming project I accidentally discovered that FormatDateTime is returning UTC rather than localtime (10 hours later - 10am next day here). This was confirmed just after (and just before) midnight UTC. My desktop display is correct (local).
What is going on please?
Is it a bug; if not how do I correct this?
Title: Re: now() returning UTO rather than local (system) date/time
Post by: jamie on September 25, 2021, 02:54:02 am
Try using "DateTimeToSystemTime" and with that return use the "SystemTimeToDateTime"

With that results you should be able to use the formateDate etc/.
Title: Re: now() returning UTO rather than local (system) date/time
Post by: dbannon on September 25, 2021, 03:02:30 am
Mike, FormatDateTime uses your system defaults for some of its format (maybe 'c' from memory).  So, perhaps you need to tell us the format settings you are using ?

Code: Pascal  [Select][+][-]
  1.   memo1.append(FormatDateTime('yyyy-mm-dd : hh mm', now));

works as expected here for me on Ubuntu.

Davo
TinyPortal © 2005-2018