Get yesterday date
 

Get yesterday date

2 Posts
1 Users
0 Reactions
1,375 Views
Avatar of admin
(@mjv119gmail-com)
Estimable Member Admin
Joined: 10 years ago
Posts: 80
Topic starter  

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
This topic was modified 5 years ago by admin

   
ReplyQuote
Avatar of admin
(@mjv119gmail-com)
Estimable Member Admin
Joined: 10 years ago
Posts: 80
Topic starter  

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


   
ReplyQuote

Leave a reply

Author Name

Author Email

Title *

 
Preview 0 Revisions Saved
Share: