On OpenBSD 6.3 I can see:
foo# date
Sun Apr 1 17:00:45 CEST 2018
foo#
foo# date -d "Sun Apr 1 17:00:45 CEST 2018" +%s
1522594858
foo# date
Sun Apr 1 17:00:59 CEST 2018
foo#
that "date" doesn't supports the usual conversion.
The https://www.epochconverter.com/ says that the 1522594858 is:
Your time zone: Sunday, April 1, 2018 5:00:58 PM GMT+02:00 DST
So the date command I issued only returned the unix timestamp of the CURRENT time, not the time that I have given to convert: "Sun Apr 1 17:00:45 CEST 2018".
The Question: how to convert a given date to unix timestamp on OpenBSD? If not with the "date" command, what other shell tools could do it?
First I started to read: https://man.openbsd.org/date - but didn't find anything about converting to unix timestamp. Then I tried to google for many examples, but didn't helped.
-j
flag. That seems like it could be useful. But it seems like the input format must beYYmmddHHMMSS
(unlike FreeBSD, there is no-f
flag)