YesterdayDate=`TZ="EDT+24" date`
But unfortunately the code failed to give the correct date of yesterday and instead it gave today's date. I thought of digging deep into this issue and logged in to a linux server to investigate the matter. After some long manipulations I observed something.
BST is 1 hour ahead of UTC $ YesterdayDate=`TZ="BST+23" date`
The script "EDT+24" gave only GMT/UTC time and inorder to get the correct timezone I needed to add the offset value for the particular time zone. After I made the changes the script seems to be working fine.
EDT is 4 hours behind of UTC $ YesterdayDate=`TZ="EDT+28" date`
CDT is 5 hours behind of UTC $ YesterdayDate=`TZ="CDT+29" date`
MDT is 6 hours behind of UTC $ YesterdayDate=`TZ="MDT+30" date`
PDT is 7 hours behind of UTC $ YesterdayDate=`TZ="PDT+31" date`
I'm still a bit confused as to why the $TZ is behaving so unexpectedly.
Note: I'm just a novice and not an expert in Unix or Shell Scripting. I just wanted to share my experience with timezones on linux servers.