Getting Yesterdays or Tomorrows Day With Bash Shell Date Command

Originally published at:

When invoked without arguments, the date command displays the current date and time. Depending on the options specified, the date would set the date and time or print it in a user-defined format. However, how do you get yesterdays with bash? What about tomorrows day? I have seen many sysadmins writing Perl scripts for calculating relative dates such as yesterdays or tomorrows day. You can use the GNU , which is designed to handle relative date calculation such as: