I need to add 6 months to the date that is selected on the form. The date is intered in from a select box and then made into a variable with the correct syntax to build a TIMESTAMP value.
I need both values and would much prefer to keep the user from having to select the date and add 6 months. Too much room for error for some. $sentdate is what I have, $defaultwarranty is what I need to figure out.
$sentdate = ($year . $month . $day); $defaultwarranty = ($sentdate + 6 months);
In order to add 6 months on to $sentdate, what would be the best way to go about it? Thanx much
Nico
MySQL provides time functions, use the DATE_ADD() function and assign it to the warranty field in the database:
DATE_ADD("$year-$month-$day", INTERVAL 6 MONTH);
I'd use this... int mktime ( int hour, int minute, int second, int month, int day, int year [, int is_dst])
$defaultwarranty = mktime ( 0, 0, 0, ( $month + 6 ), $day, $year );
[/B]
thanx for the replies guys-- that works perfectly-- thanx!