我想计算一个月的天数。它出现了这个警告:
cal_days_in_month() [function.cal-days-in-month]: invalid date.
任何人都可以帮助我。:
$numberofday = new DateTime($month);
$numberofday = cal_days_in_month(CAL_GREGORIAN, $month,$year1);
$Total=$length x 24 x $numberofday ;
我想计算一个月的天数。它出现了这个警告:
cal_days_in_month() [function.cal-days-in-month]: invalid date.
任何人都可以帮助我。:
$numberofday = new DateTime($month);
$numberofday = cal_days_in_month(CAL_GREGORIAN, $month,$year1);
$Total=$length x 24 x $numberofday ;
$月 = 4;
$year1 = 2013;
$numberofday = cal_days_in_month(CAL_GREGORIAN, $month,$year1);
回声 $numberofday; //30
你有'长度',应该是 $length 吗?
cal_days_in_month()
接受月份字段的整数值,请将月份转换为整数:
$month = "april";
$year1 = "2013";
$month = date('m', strtotime($month));
在使用该功能之前。
$numberofday = cal_days_in_month(CAL_GREGORIAN, $month, $year1);
替代品cal_days_in_month
:
$month = "april";
$year1 = "2013";
$numberofday = date('t', strtotime("$year1-" . date("m",strtotime($month)) . "-01"));
还:
$Total=$length x 24 x $numberofday;
应该:
$Total=$length * 24 * $numberofday;