3 edited tags
| link
2 added 72 characters in body
source | link

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 QuestionThe 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.

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?

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.

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.

1
source | link

Convert a date to UNIX timestamp on OpenBSD

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?

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.