阅读并重新阅读了文档,并且真的无法解释为什么 $date1 会出现问题
有人可以帮忙吗?非常感谢
$date1 = "04-16-2013";
$date2 = "2013-04-16";
printf("date1 = %s\n", $date1);
printf("date2 = %s\n", $date2);
$newdate1 = date('m-d-Y',$date1);
$newdate2 = date('Y-m-d',$date2);
printf("newdate1 = %s\n", $newdate1);
printf("newdate2 = %s\n", $newdate2);
$previous_date = date('m-d-Y', strtotime($date1 .' -1 day'));
$previous_date2 = date('m-d-Y', strtotime($date2 .' -1 day'));
printf("previous_date = %s\n", $previous_date);
printf("previous_date2 = %s\n", $previous_date2);
输出
date1 = 04-16-2013
date2 = 2013-04-16
newdate1 = 12-31-1969
newdate2 = 1969-12-31
previous_date = 12-31-1969
previous_date2 = 04-15-2013