How do I get the current time in a different TimeZone in Delphi? -
how current time different time zones in delphi. if use tidsntp give me time zone in locale.
you can convert local time different time zone delphi-tzdb (time zone database delphi).
following example documentation.
var lsydney: ttimezone; lmadeuplocaltime, luniversaltime, lsydneytime: tdatetime; begin // sydney time zone lsydney := tbundledtimezone.gettimezone('australia/sydney'); // encode local date/time value -- 14th march 2009 @ 12:45:00 pm lmadeuplocaltime := encodedatetime(2009, 03, 14, 12, 45, 00, 00); // find out time in sydney @ moment luniversaltime := ttimezone.local.touniversaltime(lmadeuplocaltime); lsydneytime := lsydney.tolocaltime(luniversaltime); writeln(format('when in time zone time %s, in sydney %s.', [datetimetostr(lmadeuplocaltime), datetimetostr(lsydneytime)])); end;
Comments
Post a Comment