PHP生成日期序列

<?php

$d0 = '2010-04-20';

$d1 = '2010-04-23'; 

$_time = range(strtotime($d0), strtotime($d1), 24*60*60);

$_time = array_map(create_function('$v', 'return date("Y-m-d", $v);'), $_time);

print_r($_time);
?>

strtotime() 函数将任何字符串的日期时间描述解析为 Unix 时间戳(自 January 1 1970 00:00:00 GMT 起的秒数)。

语法格式:int strtotime ( string $time [, int $now = time() ] )

string create_function ( string $args , string $code )   根据传递的参数创建匿名函数,并为其返回唯一名称。

猜你喜欢

转载自blog.csdn.net/jlulxg/article/details/83115945
今日推荐