Get yesterday date
6 Views
ReplyL
Legacy User 1
8/1/2019, 11:31:53 AM
Hi All,
In my shell script, i need yesterdays date to be assigned to a varaible. Using below command command I able to get the todays date. Please help me to get yesterdays date in same formay.(DD-MMM-YYYY)
today_date=date '+%d-%h-%Y' | tr [:lower:] [:upper:]
echo $today_date
1 Reply
L
Legacy User 1
8/1/2019, 11:35:48 AM
This perfectly works for me in SunOS.
yesterday_date=TZ=EST+24 date +%d-%h-%Y | tr [:lower:] [:upper:]
echo ${yesterday_date}
01-Aug-2019
Continue Reading
View all in unix-linux→Related Discussions
Latest Articles
Leave a Reply
All replies are subject to pre-moderation. Your reply will appear publicly once approved.