Skip to content

Instantly share code, notes, and snippets.

@ryanuber
Created February 5, 2014 05:53
Show Gist options
  • Save ryanuber/8818073 to your computer and use it in GitHub Desktop.
Save ryanuber/8818073 to your computer and use it in GitHub Desktop.
Print a formatted date exactly 29 days from the 1st of every month
<?php
$result = array();
foreach (range(1, 12) as $m) {
array_push($result, date('Md', mktime(0,0,0,1,date('z', mktime(0,0,0,$m,1))+29)));
}
print implode(',', $result);
@ryanuber
Copy link
Author

ryanuber commented Feb 5, 2014

This should output:

Jan29,Mar01,Mar29,Apr29,May29,Jun29,Jul29,Aug29,Sep29,Oct29,Nov29,Dec29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment