Skip to main content

Posts

Showing posts from September, 2013

strtotime() example

int   strtotime  (  string   $time  [,  int   $now  = time()  ] ) <?php echo  strtotime ( "now" ),  "\n" ; echo  strtotime ( "10 September 2000" ),  "\n" ; echo  strtotime ( "+1 day" ),  "\n" ; echo  strtotime ( "+1 week" ),  "\n" ; echo  strtotime ( "+1 week 2 days 4 hours 2 seconds" ),  "\n" ; echo  strtotime ( "next Thursday" ),  "\n" ; echo  strtotime ( "last Monday" ),  "\n" ; echo  date (  "Y-m-d" ,  strtotime (  "2009-01-31 +1 month"  ) );  // PHP:  2009-03-03 echo  date (  "Y-m-d" ,  strtotime (  "2009-01-31 +2 month"  ) );  // PHP:  2009-03-31 $Date  =  strtotime ( '2011-02-22' );  // February 22nd, 2011. 28 days in this month, 29 next year. echo  date ( 'n/j/Y' ,  strtotime ( '+1 year, +7 days' ,  $Date ));  // add 1 year and 7 days. prints 2/29/2012 echo  "