On Tue, Jun 25, 2024 at 18:35:00 +1000, Keith Bainbridge wrote:
> On 23/6/24 00:02, Greg Wooledge wrote:
> > In mutt, it would be:
> > 
> >      set date_format="!It's %a %d%b%Y at %H:%M:%S here, where clocks are 
> > UTC%z"
> 
> I believe UTC%Z will give the :
> 
> as I get from my text expander.
> 
> Tue 25Jun2024 at 18:34:20 =UTC +10:00

Well, maybe it does.  The strftime(3) documentation doesn't support
that, though:

       %z     The +hhmm or -hhmm numeric  timezone  (that  is,  the  hour  and
              minute offset from UTC). (SU)

       %Z     The timezone name or abbreviation.

In my experience, the "timezone name or abbreviation" is useless to
anyone who doesn't live in or near that time zone, particularly since
you cannot use it as the value of a TZ variable to ask date(1) what
time it is in that time zone.

On my system, at this time of year, it prints "EDT".

hobbit:~$ printf '%(%z %Z)T\n' -1
-0400 EDT

Bash's builtin printf, when using the %(fmt)T specifier, is documented
to call strftime(3), just like mutt's date_format.  So I consider this
a valid test, without needing to write a C program, or change my
date_format variable.

Here's another test:

hobbit:~$ TZ=Australia/Eucla printf '%(%z %Z)T\n' -1
+0845 +0845

Reply via email to