Recent

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

MikeFinch

  • Jr. Member
  • **
  • Posts: 77
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: 5050
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: 1679
    • 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 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

 

TinyPortal © 2005-2018