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,

Re: [PHP] Date Comparison

2009-09-03 Thread tedd
At 10:01 AM +0200 9/3/09, J DeBord wrote: Telling someone RTFM is just rude and mean. And not taking the time to research your question before posting is what, thoughtful and kind? The phrase RTFM is something I don't like to tell people, and from what I remember, I have never said that to

Re: [PHP] Date Comparison

2009-09-03 Thread Paul M Foster
On Thu, Sep 03, 2009 at 10:20:49AM +0100, Stuart wrote: > 2009/9/3 J DeBord : > > Telling someone RTFM is just rude and mean. Manipulating dates and times can > > be confusing for beginners and experienced people alike. I would suggest > > that when a question asked here causes you to respond with

Re: [PHP] Date Comparison

2009-09-03 Thread Stuart
2009/9/3 J DeBord : > Telling someone RTFM is just rude and mean. Manipulating dates and times can > be confusing for beginners and experienced people alike. I would suggest > that when a question asked here causes you to respond with RTFM, don't > respond at all. Save yourself the time and trouble

Re: [PHP] Date Comparison

2009-09-03 Thread J DeBord
Telling someone RTFM is just rude and mean. Manipulating dates and times can be confusing for beginners and experienced people alike. I would suggest that when a question asked here causes you to respond with RTFM, don't respond at all. Save yourself the time and trouble and save the person asking

RE: [PHP] Date Comparison

2009-08-29 Thread tedd
At 1:01 PM -0400 8/28/09, David Stoltz wrote: Hey Stuart - RTFM yourselfI did read it, and obviously misunderstood... I'm really sorry to bother you. I thought that was what a listserv like this was for - to ask questions... I'll try not to ask questions I should know the answer to next

RE: [PHP] Date Comparison

2009-08-28 Thread David Stoltz
om: Stuart [mailto:stut...@gmail.com] Sent: Friday, August 28, 2009 10:19 AM To: David Stoltz Cc: php-general@lists.php.net Subject: Re: [PHP] Date Comparison 2009/8/28 David Stoltz : > How to I ensure a variable date is not in the past, compared to the > current date? Here's how I

Re: [PHP] Date Comparison

2009-08-28 Thread tedd
At 10:12 AM -0400 8/28/09, David Stoltz wrote: How to I ensure a variable date is not in the past, compared to the current date? Here's how I'm trying, unsuccessfully: $nextdate = "8/2/2009"; if(strtotime($nextdate)<=getdate()){ echo "Sorry, your next evaluation date cannot be in the p

Re: [PHP] Date Comparison

2009-08-28 Thread Stuart
2009/8/28 David Stoltz : > How to I ensure a variable date is not in the past, compared to the > current date? Here's how I'm trying, unsuccessfully: > > $nextdate = "8/2/2009"; > > if(strtotime($nextdate)<=getdate()){ > >        echo "Sorry, your next evaluation date cannot be in the past, > Click

[PHP] Date Comparison

2009-08-28 Thread David Stoltz
How to I ensure a variable date is not in the past, compared to the current date? Here's how I'm trying, unsuccessfully: $nextdate = "8/2/2009"; if(strtotime($nextdate)<=getdate()){ echo "Sorry, your next evaluation date cannot be in the past, Click BACK to continue."; exit;

Re: [PHP] Date comparison Question

2008-04-07 Thread Daniel Brown
On Mon, Apr 7, 2008 at 1:03 PM, <[EMAIL PROTECTED]> wrote: > Dan I made a solution as below. > > > $time1 = strtotime("$sqldata[CaldTime]"); > $time2 = strtotime("$sqldata[CallEnd]"); > $interval = $time2 - $time1; > $TLength = date("i:s", strtotime("2008-01-01 01:00:$interval")); > > Result

Re: [PHP] Date comparison Question

2008-04-07 Thread admin
Dan I made a solution as below. $time1 = strtotime("$sqldata[CaldTime]"); $time2 = strtotime("$sqldata[CallEnd]"); $interval = $time2 - $time1; $TLength = date("i:s", strtotime("2008-01-01 01:00:$interval")); Result 01:45 Works perfect for me. Do you agree or disagree dan? On Mon, Apr 7, 200

Re: [PHP] Date comparison Question

2008-04-07 Thread Daniel Brown
On Mon, Apr 7, 2008 at 11:42 AM, <[EMAIL PROTECTED]> wrote: > I am having a date time comparison issue. > I have statically set the values here. But the data is fed from the > database, CaldTime is timestamp and since it will not allow me to have 2 > timestamps in the same table I set the CallE

Re: [PHP] Date comparison Question

2008-04-07 Thread admin
Thank you that is exactly what i did to figure it out. Just was having a brain fart there for a minute. On Mon, Apr 7, 2008 at 11:42 AM, <[EMAIL PROTECTED]> wrote: >t the data is fed from the database, CaldTime is timestamp and since it will not allow me to have 2 timestamps in > the same table

Re: [PHP] Date comparison Question

2008-04-07 Thread admin
Yes my mistake was looking at another record and published another. But I figured it out now i can publish 1:45 like i wanted. Having a moment there. Thank you Richard L. Buskirk    On Mon, Apr 7, 2008 at 9:42 AM, <[EMAIL PROTECTED]> wrote: I am having a date time comparison issue. I have st

Re: [PHP] Date comparison Question

2008-04-07 Thread Mark J. Reed
On Mon, Apr 7, 2008 at 11:42 AM, <[EMAIL PROTECTED]> wrote: >t the data is fed from the database, CaldTime is timestamp and since it will not allow me to have 2 timestamps in > the same table ?? What database are you using? It sounds like it has a specific meaning of "timestamp" - probably "the

Re: [PHP] Date comparison Question

2008-04-07 Thread Nathan Nobbe
On Mon, Apr 7, 2008 at 9:42 AM, <[EMAIL PROTECTED]> wrote: > I am having a date time comparison issue. > I have statically set the values here. But the data is fed from the > database, CaldTime is timestamp and since it will not allow me to have 2 > timestamps in the same table I set the CallEnd v

[PHP] Date comparison Question

2008-04-07 Thread admin
I am having a date time comparison issue. I have statically set the values here. But the data is fed from the database, CaldTime is timestamp and since it will not allow me to have 2 timestamps in the same table I set the CallEnd varchar(12). Storing the data they seem to be the same for output

[PHP] [ERR] RE: [PHP] Date comparison

2004-02-04 Thread postmaster
Transmit Report: To: [EMAIL PROTECTED], 402 Local User Inbox Full ([EMAIL PROTECTED]) --- Begin Message --- BEOI 7308 wrote: > Hi > > I want to substract $first_date to $second_date and print the result > this way : > > xx days, xx hours, xx minutes > > i tried (strtotime($second_date)-strtot

RE: [PHP] Date comparison

2004-02-04 Thread Burhan Khalid
BEOI 7308 wrote: > Hi > > I want to substract $first_date to $second_date and print the result > this way : > > xx days, xx hours, xx minutes > > i tried (strtotime($second_date)-strtotime($first_date)) but what i > get is a timestamp and i dont know what to do with it > > Is there already a

[PHP] Date comparison

2004-02-04 Thread BEOI 7308
Hi I want to substract $first_date to $second_date and print the result this way : xx days, xx hours, xx minutes i tried (strtotime($second_date)-strtotime($first_date)) but what i get is a timestamp and i dont know what to do with it Is there already a function to print the result in a human r

Re: [PHP] Date Comparison

2003-01-11 Thread Jason Wong
On Saturday 11 January 2003 21:38, Dhaval Desai wrote: > Hello ppl, > > > Well, I want to compate date is php, could anybody tell me which is the > best way to do so? I have tried various ways but nothing seems consistent. > I tried for example: > if("2003-1-15" > "2003-1-11") > { > echo "true"; >

Re: [PHP] Date Comparison

2003-01-11 Thread Matt
>- Original Message - >From: "Dhaval Desai" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Saturday, January 11, 2003 8:38 AM >Subject: [PHP] Date Comparison > Well, I want to compate date is php, could anybody tell me which is the best way to

[PHP] Date Comparison

2003-01-11 Thread Dhaval Desai
Hello ppl, Well, I want to compate date is php, could anybody tell me which is the best way to do so? I have tried various ways but nothing seems consistent. I tried for example: if("2003-1-15" > "2003-1-11") { echo "true"; } which doesn't work in some cases... Thank you! Best Regards, Dhava

Re: [PHP] date comparison

2002-11-10 Thread Justin French
Is it too late to change the way you insert dates into the DB? I really think the unix timestamp is the easiest way to store dates... comparisons are easy, because everything is in seconds, and using date() gives you the ability to re-format your dates over and over again for presentation purposes

RE: [PHP] date comparison

2002-11-10 Thread John W. Holmes
> I have a problem here again regarding the date comparison. I need to > check the most recent date that was entered in mysql database in date > format ("Y-m-d"), if the datetoday is a day or two days in advanced > compared to the queried date. > I need to make sure that the next inserted date in

[PHP] date comparison

2002-11-10 Thread Michael P. Carel
hi to all again, I have a problem here again regarding the date comparison. I need to check the most recent date that was entered in mysql database in date format ("Y-m-d"), if the datetoday is a day or two days in advanced compared to the queried date. I need to make sure that the next insert

Re: [PHP] date comparison again

2002-05-09 Thread Scott St. John
Thank you Miguel! I was missing the /86400 and it works much better now :) On Thu, 9 May 2002, Miguel Cruz wrote: > On Wed, 8 May 2002, Scott St. John wrote: > > Sorry to be so thick this morning, but I have a unix time stamp in my MS > > Sql server that is the date, plus 60 days to expi

Re: [PHP] date comparison again

2002-05-09 Thread Miguel Cruz
On Wed, 8 May 2002, Scott St. John wrote: > Sorry to be so thick this morning, but I have a unix time stamp in my MS > Sql server that is the date, plus 60 days to expire a password. I want to > take today's date and compare to the two to see: > 1)How many days until the password expires > 2)If

Re: [PHP] date comparison

2002-04-29 Thread Justin French
In my experience, it's best to keep everything is unix time stamp format -- soo easy for comparisons, and the function to convert it out to -MM-DD took me 45 seconds :) Justin French on 30/04/02 6:29 AM, Richard Fox ([EMAIL PROTECTED]) wrote: > I have a date string, let's call it 'date

Re: [PHP] date comparison

2002-04-29 Thread Richard Baskett
ECTED]> > Date: Mon, 29 Apr 2002 16:29:14 -0400 > To: [EMAIL PROTECTED] > Subject: [PHP] date comparison > > I have a date string, let's call it 'date a' in the format "2020-10-16" > which I want to compare to the UNIX_TIMESTAMP overflow limit ("2038-

[PHP] date comparison

2002-04-29 Thread Richard Fox
I have a date string, let's call it 'date a' in the format "2020-10-16" which I want to compare to the UNIX_TIMESTAMP overflow limit ("2038-01-18"). Obviously I can't convert date 'a' to a timestamp because it may be too large. How can I make this comparision without converting it to a timestamp?

RE: [PHP] date comparison expressions

2002-04-01 Thread Rick Emery
Are you retrieving the stored date from a mySQL database? If so, you can let mysql SELECT only those records that fit the tardy date criteria. -Original Message- From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]] Sent: Monday, April 01, 2002 2:22 PM To: [EMAIL PROTECTED] Subject: [PHP] date

[PHP] date comparison expressions

2002-04-01 Thread ROBERT MCPEAK
I'd like to compare today's date against a stored date, and then fire some code based on the result. Like. if ($today's_date < stored_date+5 days) then {blah} Can somebody clue this newbie in on how to do this? -Bob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: ht

Re: [PHP] Date Comparison Question

2001-01-30 Thread Richard Lynch
> The display works great until I get to the end of the month (like now). I > have separated the date as three rows in my dB (msg_year, msg_month and > msg_day) Don't do that. :-^ > As soon as the next month starts, then I get 4 events. > > I know exactly what's wrong, But my non-programmer limi

[PHP] Date Comparison Question

2001-01-26 Thread Martin Fernandez
I'm fairly new to php and still learning it's nuances, etc. I've created a site - http://www.more-mtb.org - in which I have used several php resources from around the net and some which I have created my self. On the home page of the site I have inserted some code that displays a series of events

Re: [PHP] date comparison

2001-01-15 Thread Joe Stump
PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Sunday, January 14, 2001 11:37 PM > Subject: RE: [PHP] date comparison > > > > > can I used the value from that variables to compare with another > > > date value? Say another date value I will use is also retrieved &

Re: [PHP] date comparison

2001-01-15 Thread Joe Stump
The way you want to do this is with UNIX timestamps. FYI a timestamp is the number of seconds starting at 1970 and going up (it's important to remember that date - since some people were born before, etc.) So you need to do this: $dateA = '12-25-1999'; $dateB = '12-24-1999'; // conve

RE: [PHP] date comparison II

2001-01-14 Thread Jason Murray
> may be I did not make my question clear about what I try to > do. Basically if I have 2 date values in the same format like > -mm-dd, can I use both values to find out if one come > before another and then display message or something? Say I > have $date1 = 20010115 and $date2 = 20010120

[PHP] date comparison II

2001-01-14 Thread [EMAIL PROTECTED]
Hi people, may be I did not make my question clear about what I try to do. Basically if I have 2 date values in the same format like -mm-dd, can I use both values to find out if one come before another and then display message or something? Say I have $date1 = 20010115 and $date2 = 20010120

Re: [PHP] date comparison

2001-01-14 Thread [EMAIL PROTECTED]
; Sent: Sunday, January 14, 2001 11:37 PM Subject: RE: [PHP] date comparison > > can I used the value from that variables to compare with another > > date value? Say another date value I will use is also retrieved > > from a field in table which is in Date data type as well. > &g

RE: [PHP] date comparison

2001-01-14 Thread Jason Murray
> can I used the value from that variables to compare with another > date value? Say another date value I will use is also retrieved > from a field in table which is in Date data type as well. When you get into this stuff, it all starts getting a lot more complicated. If you want to compare tw

[PHP] date comparison

2001-01-14 Thread [EMAIL PROTECTED]
Greeting all, Just now I asked about to tie string values together and would like to thank Jason for that. Anyway one more thing, after I have tied string values together and assigned that to a virables. can I used the value from that variables to compare with another date value? Say another date