Date

DateInterval/DatePeriod

<?php
$db 
= new DateTime('2009-12-31');
$de = new DateTime('2010-12-31');
$next 'third tuesday of next month';
$di DateInterval::createFromDateString($next);
$dp = new DatePeriod($db$di$deDatePeriod::EXCLUDE_START_DATE);
foreach(
$dp as $dt) {
   echo 
$dt->format("F jS\n") . "<br>\n";
}
?>
Output
January 19th
February 16th
March 16th
April 20th
May 18th
June 15th
July 20th
August 17th
September 21st
October 19th
November 16th
December 21st
Controllable strtotime() via date_create_from_format()

<?php
$date 
strtotime("08-01-07");
echo 
date("M.j, Y"$date);
echo 
"<br>\n";
$date date_create_from_format("m-d-y""08-01-07");
echo 
$date->format('M.j, Y');
?>
Output
Jan.7, 2008
Aug.1, 2007
Better error reporting when we are unable to parse the date.

<?php
try {
  
$date = new DateTime('Nov 33, 2011');
} catch(
Exception $E) {
  
print_r($E->getMessage());
}
?>
Output
Failed to parse time string (Nov 33, 2011) at position 4 (3): Unexpected character