RE: strange behaviour with strtotime()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux