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

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Sep 25 00:57:58 UTC 2020


On Thu, Sep 24, 2020 at 08:36:38PM -0400, James Blachly via Digitalmars-d-learn wrote:
> On 9/24/20 6:22 PM, mw wrote:
[...]
> > I'm just wondering what's the best way to convert sysTime to local
> > machine's time (zone)?
[...]
> 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].

Seriously, this should be put in the std.datetime docs on the first
page. It's a common operation that should not require reading through
multiple non-trivially long doc pages and piecing it together yourself.

Please file a bug against the docs if there isn't already one.


T

-- 
Nearly all men can stand adversity, but if you want to test a man's character, give him power. -- Abraham Lincoln


More information about the Digitalmars-d-learn mailing list