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 addition
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 10-13-2008
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
help in date script

below my script . Actually in my script i m taking the current date and then adding 15 days to it.
--------------------------------------------------------------------------

#!/bin/ksh

Current_day=`perl -e 'print int(time);'`
echo $Current_day

count=0
count=`expr $Current_day + 1296000`
echo $count

perl -le 'print scalar localtime('"$count"');'

perl -e '@d=localtime ((stat(shift))[9]); printf "%4d-%02d-%02d\n", $d[5]+1900,$d[4]+1,$d[3]' '"$count"'
--------------------------------------------------------------------------

the last command that converts the $count value into format YYYY-MM-DD is not working . plz help me in this?