<?php
// 抽出対象期間
$startYmd='2016-02-01';
$endYmd='2017-02-01';
// timestampに変換
$startTimestamp = strtotime($startYmd);
$endTimestamp = strtotime($endYmd);
// ループの中で増えていくtimestamp
$steppingTimestamp = $startTimestamp;
$sqlUnions = '';
while($steppingTimestamp <= $endTimestamp)
{
echo date('Ymd', $steppingTimestamp);
// 最終ループ調整
if ($steppingTimestamp != $endTimestamp) {
echo ',';
}
// 一日増やす
$steppingTimestamp = strtotime("+1 days", $steppingTimestamp);
}
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme