Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Posts
    1

    Question Unanswered: 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

  2. #2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •