[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: difference in seconds between two formatted dates ...



On Sun, Dec 17, 2023 at 03:28:58PM +0000, Albretch Mueller wrote:
> On 12/17/23, tomas@tuxteam.de <tomas@tuxteam.de> wrote:

[...]

> > You wouldn't expect bash to intuit such a crooky arithmetic as
> > Gregorian datetime [...]

>  Actually, my basic idea is if you can encode a date using formatting
> options this utility provides, then you should be able to decode it
> using the same options that same utility provides, no?

Template expansion (printf is kind of that) is usually much easier
than parsing. Parsing might even lead to ambiguities unless you have
been super careful when "designing" your "language".

Just imagine variable-length items (there are none in your case,
but how should the parser know that?)

This is also why "scanf" is much less useful than "printf".

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


Reply to: