Skip to content

Instantly share code, notes, and snippets.

@desarrolla2
Created June 21, 2012 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save desarrolla2/2966865 to your computer and use it in GitHub Desktop.
Save desarrolla2/2966865 to your computer and use it in GitHub Desktop.
$date = new DateTime('2012-01-31 00:00:00', new DateTimeZone('UTC'));
for ($m = 1; $m <= 3; $m++) {
echo $date->format('Y-m-d H:i:s') . PHP_EOL;
$date->modify('next month');
}
// 2012-01-31 00:00:00
// 2012-03-02 00:00:00
// 2012-04-02 00:00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment