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

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



On Mon, Dec 18, 2023 at 07:16:25AM -0500, Greg Wooledge wrote:

[...]

> If you wreck this by putting the wrong timezone offset on your
> human-readable times [...]

If you lie about your time zone you might come in too late for
your train :-)

> In addition to that, a case has already been shown where your chosen
> format, with or without a fixed timezone offset, is ambiguous -- it
> could refer to two different times.  This is an issue everywhere
> daylight saving time is used.  It's rare, but it's real.

I'm still amazed the OP hasn't understood that "date" can output
custom formats -- and that it's not always possible to parse back
a date in some custom format into a meaningful timestamp.

For an extreme case, just try

  date +"This is not a date"

(with a tip o' the hat to René Magritte). For a less extreme example

  date +"%H:%M:%S"

(I use that every minute in my digital clock display).

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


Reply to: