Today, July 15, October 31, run the code: {code ...} the returned result is 201410. Does it mean strtotime (& quot;-1 month & quot;) is untrusted? Defines the time zone. Php-vPHP5.4.33-1 ~ Dotdeb.0 (cli) (built: Sep19201412: 00: 21) Copy... today, that is, July 22, October 31, run the following code:
echo date('Ym', strtotime("-1 month"));
The returned result is 201410. Is it similar?strtotime("-1 month")
Is it untrusted?
Defines the time zone.
Php-v
PHP 5.4.33-1 ~ Dotdeb.0 (cli) (built: Sep 19 2014 12:00:21)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
Reply content:
Today, July 22, October 31, run the following code:
echo date('Ym', strtotime("-1 month"));
The returned result is 201410. Is it similar?strtotime("-1 month")
Is it untrusted?
Defines the time zone.
Php-v
PHP 5.4.33-1 ~ Dotdeb.0 (cli) (built: Sep 19 2014 12:00:21)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
Case TIMELIB_MONTH: s-> time-> relative. m + = amount * relunit-> multiplier; break; the month is directly reduced by 1. The current date December 1, is changed to January 1 ,.
This is a php bug. You can specify the start time of the month.
$ Base = strtotime (date ('Y-m', time (). '-01 00:00:01 ');
Echo date ('m/Y', strtotime ('-1 month', $ base ));
Is it true that the time zone is not defined? After the time zone is defined, it is normal for me to use the PHP5.5 environment.
date_default_timezone_set("Asia/Shanghai");echo date("Y-m", strtotime("-1 month"));
It may be true that @ beautiful style is a BUG (I don't know if it is the BUG in 5.2.7 after reading the manual). It is normal after defining the relative time according to his statement.
echo date("Y-m", strtotime("-1 month", strtotime("first day of this month")));