Tad*_*eck 10
这可以正确完成工作:
echo date('Y-m-01 - Y-m-t', strtotime('previous month'));
Run Code Online (Sandbox Code Playgroud)
以下是证明:http://ideone.com/L82ZW
$last_month_first_day=strtotime('first day of last month');
$no_of_days=date('t',$last_month_first_day);
$date_value=$last_month_first_day;
for($i=0;$i<$no_of_days;$i++)
{
echo date('Y-m-d',$date_value)."<br>";
$date_value=strtotime("+1 day",$date_value);
}
Run Code Online (Sandbox Code Playgroud)
此代码将打印您想要的内容..
第一次约会:
echo date('Y-m-d',strtotime('first day of last month'));
Run Code Online (Sandbox Code Playgroud)
上次日期:
echo date('Y-m-d',strtotime('last day of last month'));
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8949 次 |
最近记录: |