Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-20 Thread Terry Ally (Gmail)
It's a nice shortcut Jim. Never considered that. Thanks. On 20 November 2012 21:03, Jim Lucas wrote: > On 11/12/2012 02:06 AM, Duken Marga 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($showsRe

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-20 Thread Jim Lucas
On 11/12/2012 02:06 AM, Duken Marga 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']))); Won't this give you the same results without the extra conversion steps? $todaydate = date("U");

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-20 Thread Terry Ally (Gmail)
Dear Duken, Many thanks for the solution. It worked! And thanks to everyone else who pitched in with various solutions. Regards Terry On 12 November 2012 10:06, Duken Marga wrote: > Try this: > > $todaydate = strtotime(date("D, M jS, Y g:i:s a")); > $showenddate = strtotime(date("D, M jS, Y g

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-13 Thread Matijn Woudt
On Tue, Nov 13, 2012 at 5:11 AM, Kanishka wrote: > 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 > > Only if you're running 32bit OS. If you're running 64bit OS with 64bit PHP you can represent about 580 bil

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-12 Thread Kanishka
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 wrote: > Try this: > > $todaydate = strtotime(date("D, M jS, Y g:i:s a")); > $showenddate = strtotime(date("D, M jS, Y

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-12 Thread Duken Marga
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 conve

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-12 Thread ma...@behnke.biz
"Terry Ally (Gmail)" hat am 11. November 2012 um 19:30 geschrieben: > 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 ($todayda

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-11 Thread Stuart Dallas
On 11 Nov 2012, at 19:24, "Terry Ally (Gmail)" wrote: > I reversed it as you suggested and every future show is displaying as having > ended. In that case the code you're showing us is not the code you're running, because that's the obvious error in test.php. -Stuart -- Stuart Dallas 3ft9 L

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-11 Thread Terry Ally (Gmail)
Stuart, I reversed it as you suggested and every future show is displaying as having ended. Terry On 11 November 2012 19:11, Stuart Dallas wrote: > Please include the list when replying. > > On 11 Nov 2012, at 19:08, "Terry Ally (Gmail)" > wrote: > > > What I want is the reverse. > > > > I wa

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-11 Thread Stuart Dallas
Please include the list when replying. On 11 Nov 2012, at 19:08, "Terry Ally (Gmail)" wrote: > What I want is the reverse. > > I want that if people attempt to access the show page after the show has > ended that it triggers an error which takes it to another page. The actual > conditional st

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-11 Thread Stuart Dallas
On 11 Nov 2012, at 19:00, "Terry Ally (Gmail)" wrote: > Hi Shiplu and Stuart, > > Comparing timestamps was my first option. I've reinstated it. Have a look > at http://www.lakesidesurrey.co.uk/test.php (show_source included) and you > will see that PHP is still outputting the wrong thing. > > I

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-11 Thread Terry Ally (Gmail)
Hi Shiplu and Stuart, Comparing timestamps was my first option. I've reinstated it. Have a look at http://www.lakesidesurrey.co.uk/test.php (show_source included) and you will see that PHP is still outputting the wrong thing. I just can't figure out what's wrong. Terry On 11 November 2012 18:48

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-11 Thread Stuart Dallas
On 11 Nov 2012, at 18:30, "Terry Ally (Gmail)" wrote: > 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'])); The date function returns a string. > if

Re: [PHP] Date comparison going wrong, wrong, wrong

2012-11-11 Thread shiplu
You can always use timestamp which is integer. $todaydate = time(); $showenddate = strtotime($showsRecord['end_date']); On Mon, Nov 12, 2012 at 12:30 AM, Terry Ally (Gmail) wrote: > Hi all, > > I am having a problem with comparing time. I am using the following: > > $todaydate = date("D, M jS,