Returning the date 2days from today

Ok here is my question, is there an easy way to return the next day to the current one ?

For example,I have an order form, where the user specifies the delivery date, via dd / mm / yyyy, but I want to do a simple check and prompt them if the day is before 2days after the current date.

The difficaulty is of course when they get to the end of the month.

Is there an easy way round this or is it a case of many many if statments.


Scott WRight
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

are you using perl?
try this..

you can as well convert this program into a sub-routine and use it wherever you want.

Hope that helps.



($sec, $min, $hour, $day, $mon, $year, $wday, $yday) = localtime (time);
$y2kyear = $year+1900;
##  Pad the month and the day with a 0
$date = sprintf("%02d",$mon).'/'.sprintf("%02d",$day).'/'.$y2kyear;
print "Current Date is $date\n";

$future = time + ($days_ahead*24*60*60);

($sec, $min, $hour, $day, $mon, $year, $wday, $yday) = localtime ($future);
$y2kyear = $year+1900;
$date = sprintf("%02d",$mon).'/'.sprintf("%02d",$day).'/'.$y2kyear;
print "$days_ahead days later the date will be $date\n";


or look in the Perl Cookbook (Camel)..

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
scottwrightAuthor Commented:
excellent worked pefect! thanks heaps
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.