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.

Regards

Scott WRight
scottwrightAsked:
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.

markhoyCommented:
are you using perl?
0
markhoyCommented:
try this..

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

Hope that helps.

#!/usr/local/bin/perl

$days_ahead=2;

($sec, $min, $hour, $day, $mon, $year, $wday, $yday) = localtime (time);
$mon++;
$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);
$mon++;
$y2kyear = $year+1900;
$date = sprintf("%02d",$mon).'/'.sprintf("%02d",$day).'/'.$y2kyear;
print "$days_ahead days later the date will be $date\n";

see: http://www.experts-exchange.com/Web/Web_Languages/CGI/Q_11811379.html

or look in the Perl Cookbook (Camel)..
0

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
0
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.