Skip to content

Instantly share code, notes, and snippets.

@listenrightmeow
Created February 26, 2013 23:31
Show Gist options
  • Save listenrightmeow/5043378 to your computer and use it in GitHub Desktop.
Save listenrightmeow/5043378 to your computer and use it in GitHub Desktop.
Build array of dates from defined date object
$cols = array();
$date = new DateTime(date('Y-m-d', strtotime('-1 week')));
for ($i = 0; $i < 7; $i++) {
$cols[$date->format('l')] = array(
'label' => $date->format('Y-m-d')
);
$date->modify('+1 day');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment