<?php
$day1 = "2008/10/20";
//add month
$day2 = date("Y/m/d", strtotime("+2 months", strtotime($day1)));
//"2008/12/20"
$day2 = date("Y/m/d", strtotime("+3 months", strtotime($day1)));
//"2009/01/20"
//add days
$day2 = date("Y/m/d", strtotime("+5 days", strtotime($day1))); //"2008/10/25"
$day2 = date("Y/m/d", strtotime("+20 days", strtotime($day1))); //"2008/11/09"
//years
$day2 = date("Y/m/d", strtotime("+2 years", strtotime($day1))); //"2010/10/20"
?>
Also we can add weeks.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment