The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: Date help
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-28-2008
innocent innocent is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 10
Date help

Hi,

Pls can some one help.
Need a script which will read a command line $1 which is a date,

then based on the date in $1 calc next day or previous day etc and output the result in YYYYMMDD format.

e.g abc.sh 01/01/2008

output required is
01/01/2008 + 1day = 01/02/2008
or
01/01/2008 + 3days = 01/04/2008

is it possible using
mydate=date -d "$1" +%m%d%y
j="$mydate" -d "next day" +%m%d%y (this does not work)

Thks in adv..