I have scenario where i have to compare two dates.
I thought of converting them to epoch seconds and do a numeric comparison.
This works fine on Linux systems.
$ date -d '2015/12/31' +%s
1451538000
$ date +%s
1449159121
But we don't have -d option in HPUX.
What would be an alternate method to convert any given date to epoch seconds on HPUX systems?
Hi jgt,
I don't have control over installing any package on the servers.
I am looking for some other alternative.May be some perl one liner kind of solution
You could try this assuming you have the -j option:-
OSX 10.7.5, default bash terminal...
date -j 'mmddHHMMccyy.ss' +%s
This gives up to the last second before the _New_Year_.
Last login: Thu Dec 3 22:06:55 on ttys000
AMIGA:barrywalker~> date -j '123123592015.59' +%s
1451606399
AMIGA:barrywalker~> date -r 1451606399
Thu 31 Dec 2015 23:59:59 GMT
AMIGA:barrywalker~> _