Shell script to get Yesterday’s or Tomorrow’s date

Following are some small commands used to get yesterday’s and tomorrow’s date

To get yesterdays date:

$ date --date="yesterday"

date --date="1 day ago"

Yesterday’s date in other format :

date –date=yesterday +%y%m%d

To get tomorrow’s date:

$ date --date='tomorrow'
$ date --date="next day"
-Sany

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s