I have a String variable in unix script having data like '2017010110
' (format is like -- %Y%m%d%H
). Please note that its not System timestamp.
Now I need to subtract -1 hour from 2017010110
. Means the output should be 2017010109
. I tried subtracting 1 from the variable.
But when the input is 2017010100, its obvious that I am gonna get wrong output 2017010099
(Expected output is 2016123123
).
Seems like I have to set my String variable to timestamp in unix to make this subtraction of 1 hour happen.
I referred Convert date time string to UNIX timestamp in bash command but couldn't find any luck.
Could someone please help me on this?