On OpenBSD 6.3 I can see:

foo# date
Sun Apr  1 17:00:45 CEST 2018
foo# date -d "Sun Apr  1 17:00:45 CEST 2018" +%s
foo# date
Sun Apr  1 17:00:59 CEST 2018

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.

  • 1
    The man page also mentions a -j flag. That seems like it could be useful. But it seems like the input format must be YYmmddHHMMSS (unlike FreeBSD, there is no -f flag)
    – Mikel
    Commented Apr 1, 2018 at 15:36

1 Answer 1


The OpenBSD date utility is used to

  1. set the date and/or time on the system, or
  2. display the current date and/or time, or
  3. parse the time and date on the format [[[[[[cc]yy]mm]dd]HH]MM[.SS]] without setting the system's time, using the -j option.

It is not date conversion tool that is as flexible as GNU date in its parsing capabilities. If you want GNU date time/date parsing capabilities, install the coreutils port/package and use gdate instead.

Also note that the -d option for OpenBSD's date is used to set the system's value for daylight saving.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .