Fli
02-23-2015, 11:07 AM
How to show date one day ago (yesterdays date) in Linux?
Here are some commands:
YESTERDAY
[user@server ~]# date -d "1 day ago" "+%Y-%m-%d"
2015-02-22
TODAY
[user@server ~]# date "+%Y-%m-%d"
2015-02-23
--------------
[user@server ~]# date
Mon Feb 23 11:01:31 UTC 2015
[user@server ~]# date --date="2 days ago"
Sat Feb 21 11:02:37 UTC 2015
Here are some commands:
YESTERDAY
[user@server ~]# date -d "1 day ago" "+%Y-%m-%d"
2015-02-22
TODAY
[user@server ~]# date "+%Y-%m-%d"
2015-02-23
--------------
[user@server ~]# date
Mon Feb 23 11:01:31 UTC 2015
[user@server ~]# date --date="2 days ago"
Sat Feb 21 11:02:37 UTC 2015