RE: [PHP] strange behaviour with strtotime()
| From: | Ford, Mike | Date: | Tue, 31 Jan 2006 12:43:53 +0000 |
| Subject: | RE: [PHP] strange behaviour with strtotime() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-229529@lists.php.net to get a copy of this message | ||
On 31 January 2006 11:24, James Benson wrote:
> Im encountering some very weird behaviour when using the following:-
>
>
> echo date("M", strtotime("next month"));
>
>
> outputs: Mar
>
>
>
> while
>
>
> echo date("r",time());
>
> outputs: Tue, 31 Jan 2006 11:21:47 +0000
>
>
>
> anyone know why?
Because 1 month from 31-Jan is 31-Feb -- which is taken to mean 02-Mar, hence the output of
date("M" ...).
2 months from now is 31-Mar, which is ok; 3 months from now would be 31-Apr, which would likewise be
taken to mean 01-May.
This is all as expected -- no bug here.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm