今天,使用PHP的DateTime
对象会更好:
<?php$ddate = "2012-10-18";$date = new DateTime($ddate);$week = $date->format("W");echo "Weeknummer: $week";
这是因为in中
mktime(),它是这样的:
mktime(hour, minute, second, month, day, year);
因此,您的订单是错误的。
<?php$ddate = "2012-10-18";$duedt = explode("-", $ddate);$date = mktime(0, 0, 0, $duedt[1], $duedt[2], $duedt[0]);$week = (int)date('W', $date);echo "Weeknummer: " . $week;?>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)