Recent

Author Topic: now() returning UTO rather than local (system) date/time  (Read 922 times)

MikeFinch

  • Jr. Member
  • **
  • Posts: 79
now() returning UTO rather than local (system) date/time
« 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?

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: now() returning UTO rather than local (system) date/time
« Reply #1 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/.
The only true wisdom is knowing you know nothing

dbannon

  • Hero Member
  • *****
  • Posts: 2796
    • tomboy-ng, a rewrite of the classic Tomboy
Re: now() returning UTO rather than local (system) date/time
« Reply #2 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
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018