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

date can't parse its own output was: difference in seconds between two formatted dates ...)



On Mon, Dec 18, 2023 at 08:17:21AM -0500, Greg Wooledge wrote:
> On Mon, Dec 18, 2023 at 02:07:14PM +0100, tomas@tuxteam.de wrote:
> > 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.
> 
> unicorn:~$ date +"On this the %dth day of the %mth month of the year %Y (Common Era), at %M minutes past the %Hth hour"
> On this the 18th day of the 12th month of the year 2023 (Common Era), at 15 minutes past the 08th hour
> unicorn:~$ date -d "$(date +"On this the %dth day of the %mth month of the year %Y (Common Era), at %M minutes past the %Hth hour")"
> date: invalid date ‘On this the 18th day of the 12th month of the year 2023 (Common Era), at 15 minutes past the 08th hour’

How 'bout

  date -d $(date +"1582-10-08T12:31:19")

...then you'd have to have a stern talk with old Gregor ;-D

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


Reply to: