我当前的脚本显示了当月的所有日期,但我希望总共30个日期,包括下个月的日期:
<?php
$dateToday = Date("d");
$currentMonthDigits = Date("m");
$currentMonthText = Date("M");
$currentYear = Date("Y");
for ( $i=$dateToday; $i<32; $i++ ) {
$theday = date('d', mktime(0,0,0,0,$i,2000));
if($theday == $dateToday)
echo "<option value='$currentYear-$currentMonthDigits-$theday'>Today</option>";
else
echo "<option value='$currentYear-$currentMonthDigits-$theday'>$theday $currentMonthText $currentYear</option>";
}
?>
$date = time();
for ( $i=$dateToday; $i<32; $i++ ) {
echo date("Y-m-d", $date) . " " . date("d M Y", $date) . "\n";
$date = strtotime(date("Y-m-d", $date) . " +1 day" );
}
输出
2015-07-06 06 Jul 2015
...
2015-07-30 30 Jul 2015
2015-07-31 31 Jul 2015
2015-08-01 01 Aug 2015
2015-08-02 02 Aug 2015
...
2015-08-06 06 Aug 2015
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句