PHP 获取日期的当前月份
大家好,我想得到一个日期的当前月份。
这是我尝试过的:
<?php
$transdate = date('m-d-Y', time());
echo $transdate;
$month = date('m', strtotime($transdate));
if ($month == "12") {
echo "<br />December is the month :)";
} else {
echo "<br /> The month is probably not December";
}
?>
但结果是错误的,它应该显示12月是月份:0
有什么想法吗?谢谢。