我要编写一个函数,如果它在两个日期之间,它将返回一个特定的日子......我一直在尝试使用 mktime,但它一直返回 12 月?
本质上,我正在尝试这样做:
$now = date('F d, Y');
if($now [is Between July of last year and January of next year] ) {
//Output last day of January in this year
} elseif($now [is Between January of this year and July of this year]) {
//Output last day of July for next year
}
我对是否需要使用 mktime 或 strtotime 感到有些困惑?为了确定明年一月,我在下面尝试了,但它返回了 2012 年 12 月?
$jan = date("F,Y", mktime(0, 0, 0, 1, 0, $year+1));