unix - 'date -d' not working in my ksh shell -
i need calculate difference between 2 dates , result in hh:ss format.
but problem is, date/shell not support '-d' flag. of articles suggesting '-d' option only.
input date format = '07-apr-2017 02:19:20'
this equivalent to
date +"%d-%b-%y %h:%m:%s"
when used date -d, getting error "invalid character in date/time specification"
i bet ksh93t+
should support printf '%(fmt)t'
.
[step 101] $ echo ${.sh.version} version ajm 93u+ 2012-08-01 [step 102] $ date -d '07-apr-2017 02:19:20' +%s # gnu date 1491502760 [step 103] $ printf '%(%s)t\n' '07-apr-2017 02:19:20' 1491502760 [step 104] $
Comments
Post a Comment