Re: dst and strtotime

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

 



On 3/14/07, Jake McHenry <linux@xxxxxxxxxxxxxxxxx> wrote:
> He meant  + 24 * 60 * 60 not * 24 * 60 * 60
>
> The idea is to ADD the number of seconds in one day to shift your time
> over by one day, not to multiply the time by the number of seconds in
> one day, which is just plain ridiculously high number beyond the scale
> of Unix time stamp.
>
> I would recommend checking the OS for recent DST related patches, and
> figuring out why one function thinks your computer us in EST but the
> other one thinks your computer is in EDT, because adding a day is just
> a band-aid, not medicine.
>


I agree, already said this.... but the dst update seems fine on the system,
and its kinda hard to mess up. And it only needs an hour to kick it back
into the right date I found.

time() and date() return correctly, its just strtotime that pulls from EST
instead of EDT for some reason....
Quite strange, but it is fixed in PHP5, so nothing to worry about i think.
If you don't want to upgrade, you can use the fix i provided, It
doesn't harm. Also you might be able to set the timezone to something
outside a EST/EDT region. (like the netherlands (CET))
but of course when doing that, time and date wouldn't return the right values...

Tijnema



> On Tue, March 13, 2007 11:52 am, Jake McHenry wrote:
>>> On 3/13/07, Jake McHenry <linux@xxxxxxxxxxxxxxxxx> wrote:
>>>>
>>>>
>>>> >> -----Original Message-----
>>>> >> From: Jake McHenry [mailto:linux@xxxxxxxxxxxxxxxxx]
>>>> >> Sent: Tuesday, March 13, 2007 11:22 AM
>>>> >> To: For users of Fedora; PHP-General
>>>> >> Subject: Re:  dst and strtotime
>>>> >>
>>>> >> A little more info:
>>>> >>
>>>> >> strtotime("last monday")      or yesterday, is correct, but
>>>> >> strtotime("last
>>>> >> sunday") gives me 3/10 (saturday), strtotime("last saturday")
>>>> gives me
>>>> >> 3/9
>>>> >> (Friday), "last friday" gives me 3/8 thursday...... etc. maybe
>>>> it will
>>>> >> go
>>>> >> away after a week??????
>>>> >>
>>>> >
>>>> >
>>>> > What is the output of the below?
>>>> >
>>>> > echo date("Y-m-d g:i A T", time());
>>>> > echo date("Y-m-d g:i A T", strtotime("last sunday"));
>>>>
>>>>
>>>> 2007-03-13 12:30 PM EDT
>>>> 2007-03-10 11:00 PM EST
>>>>
>>> Hmm, EST and EDT ?
>>> There's the problem i think, as it is 11PM, making it 12PM it means
>>> next
>>> day.
>>> You could fix this with adding 24*60*60 to the result of strtotime()
>>> ,
>>> or change it somehow ...
>>>
>>> So this would give you the right date:
>>> echo date("Y-m-d g:i A T", strtotime("last sunday") * 24*60*60);
>>>
>>>
>>> Tijnema
>>>
>>
>>
>> That gives me this:
>>
>>
>> 1903-11-13 2:32 AM EST
>>
>>
>> Thanks,
>> Jake
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>

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


[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