[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: displaying Date using local timezone
From: |
Ken Hornstein |
Subject: |
Re: displaying Date using local timezone |
Date: |
Tue, 16 Mar 2021 18:38:11 -0400 |
>Oh, sure. I guess I was thinking of a more robust solution, that
>wouldn't require editing that line when my timezone changes twice a
>year. :-)
Boy, EVERYONE's a critic :-)
You could use the %(dst) function to do the appropriate branching;
you might need to duplicate a fair amount of the format instructions,
though. But ... maybe not.
%<(dst{text})%(void(zone{text}))%(void(ne -300))%|%(void(zone{text}))%(void(ne
-240))%>
I mean, substitute the correct values for -300 and -240. I think that
should set num to 1 or 0 depending if the timezone is equivalent to your
local timezone, and then you can go from there.
I think ... aside from that, we'd need a new format instruction that
tests if a particular timestamp is in your local timezone. Related
question: HOW do we determine that? I guess what nmh does is
conver the time to a time_t, and then calls localtime() on it. If
the timezone offsets don't match, then it's not local.
I understand what you're trying to do; but it's kind of limiting with the
format language since you only have two variables and comparisons have
to be done against literal values.
--Ken
Re: displaying Date using local timezone, hymie, 2021/03/16