what's the best way to convert a sysTime to local machine's time (zone)?

James Blachly james.blachly at gmail.com
Fri Sep 25 00:36:38 UTC 2020


On 9/24/20 6:22 PM, mw wrote:
> Hi,
> 
> I'm just wondering what's the best way to convert sysTime to local 
> machine's time (zone)?
> 
> Is there any library function does this already?
> 
> 
> https://dlang.org/phobos/std_datetime_systime.html#SysTime
> 
> (The time in SysTime is kept internally in hnsecs from midnight, January 
> 1st, 1 A.D. UTC.)
> 
> Thanks.

It is definitely not easy to find.

https://dlang.org/phobos/std_datetime_systime.html#.SysTime.timezone

SysTime struct contains member fn timezone which will return the current 
settings' TZ ; you can then apply this TZ to other functions in 
std.datetime to transform datetimes to the TZ [of your choice].


More information about the Digitalmars-d-learn mailing list