php-general Digest 13 Nov 2012 13:29:33 -0000 Issue 8038

Topics (messages 319701 through 319702):

Re: Date comparison going wrong, wrong, wrong
        319701 by: Kanishka

Re: memory allocation error
        319702 by: Matijn Woudt

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
if we use a date after 19 January 2038, we can not use 'strtotime' to get
timestamp.
http://en.wikipedia.org/wiki/Year_2038_problem


On Mon, Nov 12, 2012 at 3:36 PM, Duken Marga <dukenma...@gmail.com> wrote:

> Try this:
>
> $todaydate = strtotime(date("D, M jS, Y g:i:s a"));
> $showenddate = strtotime(date("D, M jS, Y g:i:s a",
> strtotime($showsRecord['end_date'])));
>
> if ($todaydate < $showenddate):
>     echo "The date of the show has not yet arrived";
> else:
>     echo "The show has ended";
> endif;
>
> You must convert both $todaydate and $showendate with strtotime() function,
> then you can compare them.
>
> On Mon, Nov 12, 2012 at 1:30 AM, Terry Ally (Gmail) <terrya...@gmail.com
> >wrote:
>
> > Hi all,
> >
> > I am having a problem with comparing time. I am using the following:
> >
> > $todaydate = date("D, M jS, Y g:i:s a");
> > $showenddate = date("D, M jS, Y g:i:s a",
> > strtotime($showsRecord['end_date']));
> >
> > if ($todaydate > $showenddate):
> >     echo "The date of the show has not yet arrived";
> > else:
> >     echo "The show has ended";
> > endif;
> >
> > The problem that I am encountering is that PHP is rendering the reverse
> of
> > the equation. For example:
> >
> > If today's date is *11 Nov 2012* and the show's end date is *18 Nov
> 2012*,
> > the message that I am getting is *the show has ended* which is wrong. A
> > test example is at http://www.lakesidesurrey.co.uk/test.php.
> >
> > You can also me what I am doing wrong?
> >
> > Thanks
> > Terry
> >
>
>
>
> --
> Duken Marga
>

--- End Message ---
--- Begin Message ---
On Tue, Nov 13, 2012 at 12:23 AM, Carol Peck <carolap...@gmail.com> wrote:

>
> On 11/12/2012 11:51 AM, Matijn Woudt wrote:
>
>
>  On Mon, Nov 12, 2012 at 3:17 PM, Carol Peck <carolap...@gmail.com> wrote:
>
>> Sebastian,
>> Yes, I do , but this particular error never gets into my custom handler.
>> I have also set it so that fatal errors fall through, and that doesn't
>> seem to make any difference (again, probably because it never gets there).
>>
>> Carol
>>
>>
>  Can you post the code of the error handler? I guess the bug is there.
> Bugs like these are mostly because of recursion errors or something. (Don't
> know if it's possible, but an error inside the error handler?)
> Fatal errors will btw always fall through, you can't catch fatal errors.
> You should, for testing, turn off your custom error handler and see what it
> does.
>
>  - Matijn
>
>  Ps. Please bottom-post on this mailing list.
>
> Here is the error class (I hope I"m posting the code the right way).  I
> will turn this off for a while.
> It's main purpose is to format the message before logging.  I do know that
> things are getting logged properly.
>
> Thanks again.
>

<Snip some code>

Your hosting is using SuPHP which most likely causes these problems. You
have two options:
1) Get a better host, or even better, get a dedicated server.
2) Increase your memory limit, even though your script doesn't really
reaches that limit, it seems that SuPHP somehow messes that up. Read more
at [1].

- Matijn

[1] http://forum.inmotionhosting.com/viewtopic.php?t=3147

--- End Message ---

Reply via email to