If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Manipulating dates

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-20-05, 11:01
metamask metamask is offline
Registered User
 
Join Date: Sep 2005
Posts: 1
Question Manipulating dates

Hi folks:

Apologies in advance if this has already been answered :-) - I am unable to view the posting contents in this forum so cannot determine if this has been queried and answered earlier.

In ksh, given a date value, how do I find the corresponding date "x" number of days in the future?

I hope the question is clear with the following example:
###################################
#!/bin/ksh
dd=`/usr/bin/date +%d`
mm=`/usr/bin/date +%m`
YYYY=`/usr/bin/date +%Y`

currentDate=$YYYY-$mm-$dd
echo "Current date is $currentDate"

#In the below code, x is a variable
#it will be 90 in most cases
#I need to add x to the currentDate
# and store it in the variable futureDate

futureDate=$currentDate+$x
echo "Future date is $futureDate"
###################################

Appreciate a response.

Thanks
Reply With Quote
  #2 (permalink)  
Old 09-20-05, 11:58
ducasio ducasio is offline
Registered User
 
Join Date: Aug 2004
Location: Rome, Italy
Posts: 81
Thumbs down

hi metamask,
8 threads before you have the answer. The thread is in the same page with your thread his title title is "date manipulation" meanwhile your thread title is "Manipulating dates".

bye,
ducasio
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On