digitalmars.D.learn - what's the best way to convert a sysTime to local machine's time
- mw (8/8) Sep 24 2020 Hi,
- James Blachly (6/20) Sep 24 2020 It is definitely not easy to find.
- H. S. Teoh (10/20) Sep 24 2020 [...]
- Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= (3/11) Sep 25 2020 This library may help:
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.
Sep 24 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].
Sep 24 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
Sep 24 2020
On Thursday, 24 September 2020 at 22:22:13 UTC, 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.This library may help: https://code.dlang.org/packages/hunt-time
Sep 25 2020