PHP的strtotime函数:今年的第一天


PHP strtotime Function: first day of this year

我正在使用PHP的strtotime()函数测试一些代码,但我无法弄清楚PHP是如何解释以下内容的:

strtotime('first day of this year')

我得到Tue Sep 01 2015(目前是澳大利亚9月27日星期日)。

这是我以前不知道的"year"的一些奇怪的新用法吗?

如果您没有提到月份(并且您没有),strtotime将构建为假设您指的是当前月份。顺便说一句,年份也是如此;

strtotime('first day of January');

,因为如果在定义中跳过this year,则将使用它。

注意与…的区别

strtotime('first day of first month');

这将给你10月1日(在九月),因为它是第一个月的第一天当前