I have the following time format
"2014-06-02T16:23:13+02:00"
I want to convert it to the unix timestamp (since 1/1/1970). For the above example, The command should return:
1401725705
Are there a linux command for that?
date -d"2014-06-02T16:23:13+02:00" +%s
should work if you have a newer GNU coreutil. I tested with v8.22 latest.
if you are on a elder coreutil box like 8.4. it won't work, you could try replace the T
with space. use string "2014-06-02 16:23:13+02:00"
in date -d"2014-06-02 16:23:13+02:00" +%s
this is tested on Red Hat Enterprise Linux Server release 6.5 (Santiago)
with coreutil 8.4
$>date -d"2014-06-02 16:23:13+02:00" +%s
1401718993
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments