Solved

problem with dates

Posted on 2000-03-13
2
201 Views
Last Modified: 2006-11-17
from a form I am taking a date input. Say the user enters some date,Now  I want to add 280 or(say some number) to the above date and get a new date which I wiil be showing to the user on submit.

Please advice how to go about doing this using php with example if possible.
0
Comment
Question by:qader99
2 Comments
 
LVL 8

Accepted Solution

by:
us111 earned 10 total points
ID: 2616895
<?
# Add 100 days
$MOREDAY = 100;

# date as Month-day-Year
$mydate="03-14-2000";
$olddate = $mydate;

$mydate = split("-", $mydate);
$newdate = date( "m-d-Y", mktime(0,0,0,$mydate[0],$mydate[1]+$MOREDAY,$mydate[2]) );

print "$olddate - $newdate";
?>
0
 

Author Comment

by:qader99
ID: 2619295
Thank you ver much
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question