bashunixdatesolaris

Get the date (a day before current time) in Bash


How can I print the date which is a day before current time in Bash?


Solution

  • Sorry not mentioning I on Solaris system. As such, the -date switch is not available on Solaris bash.

    I find out I can get the previous date with little trick on timezone.

    DATE=`TZ=MYT+16 date +%Y-%m-%d_%r`
    echo $DATE