Skip to content

Instantly share code, notes, and snippets.

@chenxinlong
Created January 30, 2019 03:19
Show Gist options
  • Save chenxinlong/0eecca03d4f8efc663f3616f5efa3a18 to your computer and use it in GitHub Desktop.
Save chenxinlong/0eecca03d4f8efc663f3616f5efa3a18 to your computer and use it in GitHub Desktop.
<?php
function getDateListByRange() {
$dateRange = new \DatePeriod(
new \DateTime(date('Y-m-d', strtotime($start))),
new \DateInterval('P1D'),
(new \DateTime(date('Y-m-d',strtotime($end))))->modify('+1 day')
);
$tables = [];
foreach($dateRange as $date) {
$tables[] = $prefix . $date->format('Ymd');
}
return $tables;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment