I have a timestamp variable in YYYYYMMDDHHMMSS format. using this variable i need to keep checking in a loop whether time elapsed more than say 1 hour.
the variable is actually in a format like this 123-20150925084520
where i need to extract the second part as timestamp and then compare with current timestamp to see the number of hours. something like datediff($date1,$date2,"h")
Here is what i tried. Logged into PUTTY and under username@host:[ahome/username]$ tried below from this SOPOst
$ echo $(( ( $(date -ud '2003-08-02 17:24:33' +'%h') - $(date -ud '2003-04-21 22:55:02' +'%h') )/60/60/24 )) days
which gives date : illegal option --d
i dont see --d option but i removed -ud and tried. gives date: bad conversion
Other options are implementing complex logics coming in 10 s of lines of code. it will take days for a unix newbie like me to understand the logic. Any quick help would be appreciated.