- /**
- * date函数格式化输出指定范围的时间
- * by bbs.it-home.org
- */
- $stand = "2013-01-";
-
- for ($i = 1; $i <= 31; $i ++) {
- $time = strtotime($stand . $i);
- $date[] = date("Ymd", $time);
- }
-
- print_r($date);
- ?>
实现效果:
附,
date函数获取前一天或后一天日期
例子:
- //日期定义
- $day = date("Ymd", strtotime("-1 day"));
- echo $day."\n";
- $day = date("Ymd", strtotime("+1 day"));
- echo $day."\n";
效果如下图:
|