Hi,
i am developing a script for my project. In my script i need to check some conditions based upon some values. in that one value is the previous date. with the previous date i need to check and process some values. I have a function with me retrieve the yesterdays date.
But now i have a scenario that i need to check with the yesteday day alone. That is say for example today is Thu,i need to check one day before that is with Wed. i am not sure how to retrieve this Thu-1.
The following example used for current date from ago
#date
Tue Feb 23 14:32:14 IST 2010
#date -d "1 day ago"
Mon Feb 22 14:32:18 IST 2010
#date -d "1 week ago"
Tue Feb 16 14:32:24 IST 2010
#date -d "1 month ago"
Sat Jan 23 14:32:29 IST 2010
#date -d "1 year ago"
Mon Feb 23 14:32:35 IST 2009
The following example used for current date after
#date
Tue Feb 23 14:35:00 IST 2010
#date -d "+1 day"
Wed Feb 24 14:35:05 IST 2010
#date -d "+1 week"
Tue Mar 2 14:35:09 IST 2010
#date -d "+1 month"
Tue Mar 23 14:35:14 IST 2010
#date -d "+1 year"
Wed Feb 23 14:35:21 IST 2011