Wednesday, October 23, 2013

Epoch Time in Shell Script for the expected Date

Below is the code to get epoch time in shell script :

Code is self-explanatory for the shell script dev's.

startdate_ymd=`date --date="31 day ago" +%Y%m%d`

startdate=`date --date="${startdate_ymd}" +%s`

startdatemillis=`expr ${startdate} \\* 1000`


enddate_ymd=`date --date="1 day ago" +%Y%m%d`

enddate=`date --date="${enddate_ymd}" +%s`

enddatemillis=`expr ${enddate} \\* 1000`

No comments :

// Below script tag for SyntaxHighLighter