Hi all,
I know this may have already been asked but hey ho...
i have two dates in the 'yyyy-mm-dd hh:mm:ss' format.
'2009-01-03 01:00:00'
'2009-04-05 00:00:00'
How can i, in shell script determine their differences?
Please note, the time may not be available, so please suggest both ways as i may have dates in this format too:
i.e. for when i only have:
'2009-01-03'
'2009-04-05'
R.T
April 7, 2009, 11:59am
2
joeyg
April 7, 2009, 1:01pm
4
This might be the key command you need:
date +%s -d"2009-01-03"
will return seconds since epoch
do that twice, once for each time, storing to variables
then math will give you # seconds between two dates
finally, divide by seconds in a day
voila -- # days between two dates
I have two dates with me, and i want the difference of these two days in form of days.
what will be the code for that ?
Example:
06-Apr-2009,04-Mar-09