Hi guys,
I had a scenario...
- I had to get the previous days date in yyyymmdd format
- i had to create a file with Date inthe format yyyymmdd.txt format
both are different
thanks guys in advance..
Hi guys,
I had a scenario...
both are different
thanks guys in advance..
What's the output from the following command on your system:
date --version
Capture previous days date in yyyymmdd format
previous_day=`TZ=GMT+24 date "+%Y%m%d"`
Create a file with Date in the format yyyymmdd.txt format
touch "$previous_day".txt
Whatch out : the offset may differs depending on the timezone you are in. Have a look at
post #2 of date: illegal option -- d in sun solaris
or
post #6 of Retun yesterday's date on HP-UX
also
perl -e 'print scalar(localtime(time - 86400)), "\n"'