Re: [PHP] strtotime() bug?

2005-04-05 Thread Richard Lynch
On Mon, April 4, 2005 3:14 pm, Al said:
 Suddenly my strtotime() are goofy, anyone have any ideas?

 echo date('Y/m/d/H', time()). br; //2005/04/04/18
 echo date('Y/m/d/H', strtotime(-1 day)). br;
 //2005/04/03/18
 echo date('Y/m/d/H', strtotime(last Sunday)). br;   
 //2005/04/02/23

 Sunday shows as Saturday.

If the BIOS thinks you don't use Daylight Savings, but the OS thinks you
*DO* use Daylight Savings, but Locale thinks you don't use Daylight
Savings, but...

Or any variation on that theme.

This is just theory of what could be going wrong, without my delving too
deeply into what you typed...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] strtotime() bug?

2005-04-04 Thread Al
Suddenly my strtotime() are goofy, anyone have any ideas?
echo date('Y/m/d/H', time()). br;   //2005/04/04/18
echo date('Y/m/d/H', strtotime(-1 day)). br;
//2005/04/03/18
echo date('Y/m/d/H', strtotime(last Sunday)). br;   
//2005/04/02/23
Sunday shows as Saturday.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] strtotime bug? end of the month.

2002-10-31 Thread Jeff Bearer
date(Y-m-d,strtotime(+1 month))

returns December 1st!  This happens when you add 1 month to any day that
doesn't exist in the next month.  Quite annoying that you have to handle
it like this:

date(Y-m-d,strtotime(+1 month,strtotime(date(Y-m-1


-- 
Jeff Bearer, RCHE
Webmaster, PittsburghLIVE.com
Winner 2002 Eppy Award, Best U.S. Newspaper Website


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




Re: [PHP] strtotime bug? end of the month.

2002-10-31 Thread Adam Voigt
Not a very good solution, but +4 weeks works.

Adam Voigt
[EMAIL PROTECTED]

On Thu, 2002-10-31 at 11:33, Jeff Bearer wrote:
 date(Y-m-d,strtotime(+1 month))
 
 returns December 1st!  This happens when you add 1 month to any day that
 doesn't exist in the next month.  Quite annoying that you have to handle
 it like this:
 
 date(Y-m-d,strtotime(+1 month,strtotime(date(Y-m-1
 
 
 -- 
 Jeff Bearer, RCHE
 Webmaster, PittsburghLIVE.com
 Winner 2002 Eppy Award, Best U.S. Newspaper Website
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




Re: [PHP] strtotime bug? end of the month.

2002-10-31 Thread 1LT John W. Holmes
 date(Y-m-d,strtotime(+1 month))
 
 returns December 1st!  This happens when you add 1 month to any day that
 doesn't exist in the next month.  Quite annoying that you have to handle
 it like this:
 
 date(Y-m-d,strtotime(+1 month,strtotime(date(Y-m-1

How about

echo date('y-m-d',strtotime('next month last day'));

---John Holmes...

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




RE: [PHP] strtotime bug? end of the month.

2002-10-31 Thread Michael Hazelden
How about - and a little more complex ...

$mydate = date(d)!=1  date(d,strtotime(+1 month))==1 ?
date(Y-m-d,strtotime(+1 month)-86400) : date(Y-m-d,strtotime(+1
month));

to summarise - if you perform your +1 month and it creates a day of 1, but
the current day isn't 1 - do the same calculation, but a day less ...
otherwise - do the month more. I haven't tested it - but it should give the
results you want.

-Original Message-
From: 1LT John W. Holmes [mailto:holmes072000;charter.net]
Sent: 31 October 2002 17:10
To: Jeff Bearer; [EMAIL PROTECTED]
Subject: Re: [PHP] strtotime bug? end of the month.


 date(Y-m-d,strtotime(+1 month))
 
 returns December 1st!  This happens when you add 1 month to any day that
 doesn't exist in the next month.  Quite annoying that you have to handle
 it like this:
 
 date(Y-m-d,strtotime(+1 month,strtotime(date(Y-m-1

How about

echo date('y-m-d',strtotime('next month last day'));

---John Holmes...

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


_
This message has been checked for all known viruses by the 
MessageLabs Virus Control Centre.

This message has been checked for all known viruses by the MessageLabs Virus Control 
Centre.


*

Notice:  This email is confidential and may contain copyright material of Ocado 
Limited (the Company). Opinions and views expressed in this message may not 
necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete all 
copies of this message. Please note that it is your responsibility to scan this 
message for viruses.

Company reg. no. 3875000.  Swallowdale Lane, Hemel Hempstead HP2 7PY

*

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




Re: [PHP] strtotime bug? end of the month.

2002-10-31 Thread Jeff Bearer
Actually I only needed date(Y-m) so my solution works fine, and I
didn't consider the problems with hard coding 1 into it.  But thanks for
the replies.





On Thu, 2002-10-31 at 11:33, Jeff Bearer wrote:
 date(Y-m-d,strtotime(+1 month))
 
 returns December 1st!  This happens when you add 1 month to any day that
 doesn't exist in the next month.  Quite annoying that you have to handle
 it like this:
 
 date(Y-m-d,strtotime(+1 month,strtotime(date(Y-m-1
 
 
 -- 
 Jeff Bearer, RCHE
 Webmaster, PittsburghLIVE.com
 Winner 2002 Eppy Award, Best U.S. Newspaper Website
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Jeff Bearer, RCHE
Webmaster, PittsburghLIVE.com
Winner 2002 Eppy Award, Best U.S. Newspaper Website


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