Jump to content

Ailur

Members
  • Content Count

    3
  • Joined

  • Last visited

Everything posted by Ailur

  1. Same situation here. I have contacted Embarcadero Support, as written in that e-mail, have you? For reference, this was discussed before too:
  2. Hello everyone! Is there a way to make the following routine atomic, so it will yield the correct results even when a switch between standard time/winter time and daylight saving time/summer time happens in the middle of it? uses System.DateUtils, System.SysUtils; procedure GetUTCAndLocalNow(var UTC, Local: TDateTime); begin Local := Now; UTC := TTimeZone.Local.ToUniversalTime(Local); end; Ultimately I am looking for the UTC and the local time values to be ISO 8601 formatted strings and I am not bound to TDateTime as given in the above routine.
  3. I am open to use a different API or data types to get the values. One could say my difficulty lies with getting the correct conversion method that was valid at a past moment in time, even if that moment lies just a few milliseconds back: procedure GetUTCAndLocalNow(var UTC, Local: TDateTime); var Convert: Func<TDateTime, TDateTime>; begin Local := Now; Convert := GetConvertMethodForAPastMomentInTime(Local); // ... even if this past moment in time is just some milliseconds ago // it might have changed due to a change in DST observation UTC := Convert(Local); end;
×