Re: [PHP] date time problem

2013-10-07 Thread Jim Giner
On 10/6/2013 11:21 PM, Romain CIACCAFAVA wrote: An easier way to do that would be using the diff() method of a DateTime object on another. Regards Romain Ciaccafava Romain - you were so right. A little less calculating to be done and I got the result I wished. For anyone interested here's

Re: [PHP] date time problem

2013-10-06 Thread Farzan Dalaee
You should use gmdate() if you want to how many hours left to expire $time_left = gmdate(H:i:s,$diff); Best Regards Farzan Dalaee On Oct 7, 2013, at 1:49, Jim Giner jim.gi...@albanyhandball.com wrote: I always hate dealing with date/time stuff in php - never get it even close until an

Re: [PHP] date time problem

2013-10-06 Thread Jim Giner
On 10/6/2013 6:36 PM, Farzan Dalaee wrote: You should use gmdate() if you want to how many hours left to expire $time_left = gmdate(H:i:s,$diff); Best Regards Farzan Dalaee On Oct 7, 2013, at 1:49, Jim Giner jim.gi...@albanyhandball.com wrote: I always hate dealing with date/time stuff in

Re: [PHP] date time problem

2013-10-06 Thread Farzan Dalaee
Try this please gmdate(H:i:s, $diff%86400) Best Regards Farzan Dalaee On Oct 7, 2013, at 2:12, Jim Giner jim.gi...@albanyhandball.com wrote: On 10/6/2013 6:36 PM, Farzan Dalaee wrote: You should use gmdate() if you want to how many hours left to expire $time_left = gmdate(H:i:s,$diff);

Re: [PHP] date time problem

2013-10-06 Thread Jim Giner
On 10/6/2013 6:49 PM, Farzan Dalaee wrote: Try this please gmdate(H:i:s, $diff%86400) Best Regards Farzan Dalaee On Oct 7, 2013, at 2:12, Jim Giner jim.gi...@albanyhandball.com wrote: On 10/6/2013 6:36 PM, Farzan Dalaee wrote: You should use gmdate() if you want to how many hours left

Re: [PHP] date time problem

2013-10-06 Thread Farzan Dalaee
Its so freaky Best Regards Farzan Dalaee On Oct 7, 2013, at 2:29, Jim Giner jim.gi...@albanyhandball.com wrote: On 10/6/2013 6:49 PM, Farzan Dalaee wrote: Try this please gmdate(H:i:s, $diff%86400) Best Regards Farzan Dalaee On Oct 7, 2013, at 2:12, Jim Giner

Re: [PHP] date time problem

2013-10-06 Thread Jonathan Sundquist
This should help you out http://stackoverflow.com/questions/365191/how-to-get-time-difference-in-minutes-in-php On Oct 6, 2013 6:07 PM, Farzan Dalaee farzan.dal...@gmail.com wrote: Its so freaky Best Regards Farzan Dalaee On Oct 7, 2013, at 2:29, Jim Giner jim.gi...@albanyhandball.com

Re: [PHP] date time problem

2013-10-06 Thread Aziz Saleh
Jim, The date method takes in a timestamp (not seconds away). You have the seconds, you will need to manually convert those seconds to what you desire (minutes = seconds / 60), (hours = minutes / 60), etc.. Aziz On Sun, Oct 6, 2013 at 7:07 PM, Farzan Dalaee farzan.dal...@gmail.comwrote: Its

Re: [PHP] date time problem

2013-10-06 Thread Jim Giner
Look at my code. The inputs are all timestamps so date should work, no? My question why am i getting an hour value in this case? jg On Oct 6, 2013, at 7:14 PM, Aziz Saleh azizsa...@gmail.com wrote: Jim, The date method takes in a timestamp (not seconds away). You have the seconds, you

Re: [PHP] date time problem

2013-10-06 Thread Aziz Saleh
The resulting subtraction is not a valid timestamp, but rather the difference between the two timestamps in seconds . The resulting diff can be 1 if the timestamps are 1 seconds apart. The linkhttp://stackoverflow.com/questions/365191/how-to-get-time-difference-in-minutes-in-phpJonathan sent out

Re: [PHP] date time problem

2013-10-06 Thread Ashley Sheridan
On Sun, 2013-10-06 at 19:14 -0400, Aziz Saleh wrote: Jim, The date method takes in a timestamp (not seconds away). You have the seconds, you will need to manually convert those seconds to what you desire (minutes = seconds / 60), (hours = minutes / 60), etc.. Aziz On Sun, Oct 6,

Re: [PHP] date time problem

2013-10-06 Thread Jim Giner
On 10/6/2013 7:40 PM, Aziz Saleh wrote: The resulting subtraction is not a valid timestamp, but rather the difference between the two timestamps in seconds . The resulting diff can be 1 if the timestamps are 1 seconds apart. The

Re: [PHP] date time problem

2013-10-06 Thread Jim Giner
On 10/6/2013 7:55 PM, Ashley Sheridan wrote: On Sun, 2013-10-06 at 19:14 -0400, Aziz Saleh wrote: Jim, The date method takes in a timestamp (not seconds away). You have the seconds, you will need to manually convert those seconds to what you desire (minutes = seconds / 60), (hours = minutes

Re: [PHP] date time problem

2013-10-06 Thread Romain CIACCAFAVA
An easier way to do that would be using the diff() method of a DateTime object on another. Regards Romain Ciaccafava Le 7 oct. 2013 à 03:10, Jim Giner jim.gi...@albanyhandball.com a écrit : On 10/6/2013 7:55 PM, Ashley Sheridan wrote: On Sun, 2013-10-06 at 19:14 -0400, Aziz Saleh wrote:

Re: [PHP] Date weirdness

2013-04-18 Thread Larry Martell
On Thu, Mar 28, 2013 at 3:40 PM, Larry Martell larry.mart...@gmail.com wrote: On Thu, Mar 28, 2013 at 2:44 PM, Steven Staples sstap...@mnsi.net wrote: I think I am losing my mind. I have some time zone converting code, and I just don't understand what I am seeing. Also my system seems to return

RE: [PHP] Date weirdness

2013-03-28 Thread Steven Staples
I think I am losing my mind. I have some time zone converting code, and I just don't understand what I am seeing. Also my system seems to return the wrong time after I do some date operations on unrelated objects. This is from a machine that is in eastern time. I want to convert to, for

Re: [PHP] Date weirdness

2013-03-28 Thread Larry Martell
On Thu, Mar 28, 2013 at 2:44 PM, Steven Staples sstap...@mnsi.net wrote: I think I am losing my mind. I have some time zone converting code, and I just don't understand what I am seeing. Also my system seems to return the wrong time after I do some date operations on unrelated objects. This

Re: [PHP] Date weirdness

2013-03-28 Thread Maciek Sokolewicz
On 28-3-2013 22:40, Larry Martell wrote: On Thu, Mar 28, 2013 at 2:44 PM, Steven Staples sstap...@mnsi.net wrote: I think I am losing my mind. I have some time zone converting code, and I just don't understand what I am seeing. Also my system seems to return the wrong time after I do some date

Re: [PHP] Date weirdness

2013-03-28 Thread Larry Martell
On Thu, Mar 28, 2013 at 4:55 PM, Maciek Sokolewicz maciek.sokolew...@gmail.com wrote: On 28-3-2013 22:40, Larry Martell wrote: On Thu, Mar 28, 2013 at 2:44 PM, Steven Staples sstap...@mnsi.net wrote: I think I am losing my mind. I have some time zone converting code, and I just don't

Re: [PHP] date problem

2013-01-03 Thread Jonathan Sundquist
1/3/2012 is in fact less then 9/16/2012. On Thu, Jan 3, 2013 at 3:57 PM, Marc Fromm marc.fr...@wwu.edu wrote: I am comparing to dates. define('WSOFFBEGIN','09/16/2012'); $jes = 01/03/2012; if ( date(m/d/Y, strtotime($jes)) date(m/d/Y, strtotime(WSOFFBEGIN)) ) { $error

Re: [PHP] date problem

2013-01-03 Thread Serge Fonville
Hi. date returns a string You should compare a different type for bigger/smaller than HTH Kind regards/met vriendelijke groet, Serge Fonville http://www.sergefonville.nl Convince Microsoft! They need to add TRUNCATE PARTITION in SQL Server

Re: [PHP] date problem

2013-01-03 Thread Ken Robinson
At 04:57 PM 1/3/2013, Marc Fromm wrote: I am comparing to dates. define('WSOFFBEGIN','09/16/2012'); $jes = 01/03/2012; if ( date(m/d/Y, strtotime($jes)) date(m/d/Y, strtotime(WSOFFBEGIN)) ) { $error = MUST begin after . WSOFFBEGIN . \n; } I cannot figure out why the $error

RE: [PHP] date problem

2013-01-03 Thread Marc Fromm
:05 PM To: Marc Fromm Cc: php-general@lists.php.net Subject: Re: [PHP] date problem Hi. date returns a string You should compare a different type for bigger/smaller than HTH Kind regards/met vriendelijke groet, Serge Fonville http://www.sergefonville.nl Convince Microsoft! They need to add

Re: [PHP] date problem

2013-01-03 Thread Jonathan Sundquist
)){ // bla bla } Thanks From: Serge Fonville [mailto:serge.fonvi...@gmail.com] Sent: Thursday, January 03, 2013 2:05 PM To: Marc Fromm Cc: php-general@lists.php.net Subject: Re: [PHP] date problem Hi. date returns a string You should compare a different type for bigger/smaller

RE: [PHP] date problem

2013-01-03 Thread Marc Fromm
Thanks Jonathan. I removed the date() syntax function and it works. From: Jonathan Sundquist [mailto:jsundqu...@gmail.com] Sent: Thursday, January 03, 2013 2:16 PM To: Marc Fromm Cc: Serge Fonville; php-general@lists.php.net Subject: Re: [PHP] date problem Marc, When you take a date and do

Re: [PHP] date problem

2013-01-03 Thread Jim Giner
On 1/3/2013 5:22 PM, Marc Fromm wrote: Thanks Jonathan. I removed the date() syntax function and it works. From: Jonathan Sundquist [mailto:jsundqu...@gmail.com] Sent: Thursday, January 03, 2013 2:16 PM To: Marc Fromm Cc: Serge Fonville; php-general@lists.php.net Subject: Re: [PHP] date problem

Re: [PHP] date problem

2013-01-03 Thread Jim Lucas
On 01/03/2013 01:57 PM, Marc Fromm wrote: $jes = 01/03/2012; # php -r echo 01/03/2012; 0.00016567263088138 You might want to put quotes around that value so it is actually a string and does not get evaluated. -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ -- PHP

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 dukenma...@gmail.com wrote: Try this: $todaydate = strtotime(date(D, M jS, Y g:i:s a)); $showenddate =

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)
It's a nice shortcut Jim. Never considered that. Thanks. On 20 November 2012 21:03, Jim Lucas li...@cmsws.com 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,

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

2012-11-13 Thread Matijn Woudt
On Tue, Nov 13, 2012 at 5:11 AM, Kanishka kanishkani...@gmail.com 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

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

2012-11-12 Thread ma...@behnke.biz
Terry Ally (Gmail) terrya...@gmail.com 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

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

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 dukenma...@gmail.com wrote: Try this: $todaydate = strtotime(date(D, M jS, Y g:i:s a)); $showenddate =

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) terrya...@gmail.comwrote: Hi all, I am having a problem with comparing time. I am using the following: $todaydate =

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

2012-11-11 Thread Stuart Dallas
On 11 Nov 2012, at 18:30, Terry Ally (Gmail) terrya...@gmail.com 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

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

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

2012-11-11 Thread Stuart Dallas
On 11 Nov 2012, at 19:00, Terry Ally (Gmail) terrya...@gmail.com 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

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) terrya...@gmail.com 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

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 stu...@3ft9.com wrote: Please include the list when replying. On 11 Nov 2012, at 19:08, Terry Ally (Gmail) terrya...@gmail.com wrote: What I want is

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

2012-11-11 Thread Stuart Dallas
On 11 Nov 2012, at 19:24, Terry Ally (Gmail) terrya...@gmail.com 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 --

Re: [PHP] Date manipulation

2012-10-25 Thread Daniel Brown
On Thu, Oct 25, 2012 at 3:06 PM, Ron Piggott ron.pigg...@actsministries.org wrote: Is it possible for PHP to accept the following as a date: 04:11:22 Aug 21, 2011 PDT so I may output it as: gmdate(‘Y-m-d H:i:s’) - I want the time zone included Sure. ?php $ds = strtotime('04:11:22

Re: [PHP] date conversion/extraction issues

2012-05-03 Thread Jim Lucas
On 05/02/2012 02:36 PM, Haluk Karamete wrote: This is my code and the output is right after that... $PDate = $row['PDate']; //row is tapping into ms-sql date field. //and the ms-sql data field has a value like this for the PDate; //07/12/2001 $PDate = $PDate-date; echo h1[, $PDate , ]/h1; echo

Re: [PHP] date conversion/extraction issues

2012-05-03 Thread Terry Ally (Gmail)
Haluk, After you retrieve the date from the database you still have to convert it from a string to time and then to a date. Try: ?php echo date(l j M Y, , strtotime($row['PDate'])) ; ? Terry On 2 May 2012 22:36, Haluk Karamete halukkaram...@gmail.com wrote: This is my code and the output is

Re: [PHP] date conversion/extraction issues

2012-05-02 Thread Matijn Woudt
On Wed, May 2, 2012 at 11:36 PM, Haluk Karamete halukkaram...@gmail.com wrote: This is my code and the output is right after that... $PDate = $row['PDate']; //row is tapping into ms-sql date field. //and the ms-sql data field has a value like this for the PDate; //07/12/2001 $PDate =

Re: [PHP] date() confustion

2012-04-26 Thread ma...@behnke.biz
Nathan Nobbe quickshif...@gmail.com hat am 26. April 2012 um 06:40 geschrieben: INSERT TIMESTAMP: 1335414561 INSERT DATE TIME: 2012-04-26 4:29:21 But then from the interactive interpreter on the same box (same php.ini as well): php echo date(Y-m-d G:i:s, 1335414561); 2012-04-25

Re: [PHP] date() confustion

2012-04-25 Thread Simon J Welsh
On 26/04/2012, at 4:40 PM, Nathan Nobbe wrote: Hi everyone, Does anybody know what might influence the output of the date() function besides date.timezone setting? Running through some code in an app I'm working on, I have this code: $timestamp = time(); $mysqlDatetime = date(Y-m-d

Re: [PHP] date() confustion

2012-04-25 Thread Nathan Nobbe
On Wed, Apr 25, 2012 at 10:44 PM, Simon J Welsh si...@welsh.co.nz wrote: On 26/04/2012, at 4:40 PM, Nathan Nobbe wrote: Hi everyone, Does anybody know what might influence the output of the date() function besides date.timezone setting? Running through some code in an app I'm

Re: [PHP] Date function kill lots time !

2012-01-05 Thread xucheng
yes,it is set in php.ini . 2012/1/5 Adam Richardson simples...@gmail.com On Wed, Jan 4, 2012 at 11:07 PM, xucheng helloworldje...@gmail.comwrote: hi all, I have a webapp which track visitors, and use xhprof for profiling my codes . After reading some reports produced by xhprof, i found

Re: [PHP] Date function kill lots time !

2012-01-04 Thread Adam Richardson
On Wed, Jan 4, 2012 at 11:07 PM, xucheng helloworldje...@gmail.com wrote: hi all, I have a webapp which track visitors, and use xhprof for profiling my codes . After reading some reports produced by xhprof, i found that function Date() kills most time of my app ! how can this happen ?

Re: [PHP] date problem

2011-04-02 Thread Louis Huppenbauer
Just try of March. Worked for me. print first: .date(d-m-Y H:i:s,strtotime('first Tuesday of March 2011')).\n; print second: .date(d-m-Y H:i:s,strtotime('second Tuesday of March 2011')).\n; print third: .date(d-m-Y H:i:s,strtotime('third Tuesday of March 2011')).\n; print fourth: .date(d-m-Y

Re: [PHP] date problem

2011-04-02 Thread Dan Dan
It seems different php versions have different outputs for this code: Fedora Core 14 (x86): first: 01-03-2011 00:00:00 second: 08-03-2011 00:00:00 third: 22-03-2011 00:00:00 fourth: 22-03-2011 00:00:00 fifth: 29-03-2011 00:00:00 Fedora Core11 (x86_64): first: 31-12-1969 16:00:00 second:

Re: [PHP] date problem

2011-04-01 Thread Dan Dan
I removed the day (1 before the March), but its still giving the same result, i.e. different days of month with and without the 'first'. Any further help ? print first Tuesday :.date(d-m-Y H:i:s,strtotime('March 2011 Tuesday')).\n; print first: .date(d-m-Y H:i:s,strtotime('March 2011 first

Re: [PHP] Date Test...

2010-07-08 Thread Ashley Sheridan
On Wed, 2010-07-07 at 13:28 -0700, Don Wieland wrote: Hello all, I am processing an array to build an INSERT string in PHP. The code below I build an a separate array for the TARGET fields and the VALUES. I am trying to trap for a NULL ENTRY in a Date Input Field. Date fields are

Re: [PHP] Date Test...

2010-07-08 Thread Don Wieland
On Jul 8, 2010, at 10:09 AM, Ashley Sheridan wrote: thanks Ash, I figure it out. I was not entering the full year. date('y-m-d',strtotime($fval)) needed to be date('o-m-d',strtotime($fval)) Duh ;-) Thanks, Don On Wed, 2010-07-07 at 13:28 -0700, Don Wieland wrote: Hello all, I am

RE: [PHP] Date Conversion Problem

2010-06-18 Thread David Stoltz
; a...@ashleysheridan.co.uk; php-general@lists.php.net Subject: Re: [PHP] Date Conversion Problem David, I think it would help people like me (newbie) to know the exact statements. Though I could envisage what you would have done with my current learning, it would be good if I double check the statements that went

Re: [PHP] Date Conversion Problem

2010-06-17 Thread Ashley Sheridan
On Thu, 2010-06-17 at 08:35 -0400, David Stoltz wrote: PHP newbie here... I have some PHP code writing the date/time into a MS SQL 2000 database like this: date('l jS \of F Y h:i:s A') So the text it writes into the DB is like: Thursday 15th of April 2010 10:13:42 AM

RE: [PHP] Date Conversion Problem

2010-06-17 Thread David Stoltz
I would agree with you, but I have no control on inherited web apps. I now need to concentrate on trying to fix this. From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Thursday, June 17, 2010 8:38 AM To: David Stoltz Cc: php-general@lists.php.net Subject: Re: [PHP] Date

Re: [PHP] Date Conversion Problem

2010-06-17 Thread Richard Quadling
On 17 June 2010 13:35, David Stoltz dsto...@shh.org wrote: PHP newbie here... I have some PHP code writing the date/time into a MS SQL 2000 database like this: date('l jS \of F Y h:i:s A') So the text it writes into the DB is like: Thursday 15th of April 2010 10:13:42 AM The

Re: [PHP] Date Conversion Problem

2010-06-17 Thread Richard Quadling
On 17 June 2010 13:40, Richard Quadling rquadl...@gmail.com wrote: On 17 June 2010 13:35, David Stoltz dsto...@shh.org wrote: PHP newbie here... I have some PHP code writing the date/time into a MS SQL 2000 database like this: date('l jS \of F Y h:i:s A') So the text it writes into

Re: [PHP] Date Conversion Problem

2010-06-17 Thread Richard Quadling
Stoltz Cc: php-general@lists.php.net Subject: Re: [PHP] Date Conversion Problem On Thu, 2010-06-17 at 08:35 -0400, David Stoltz wrote: PHP newbie here... I have some PHP code writing the date/time into a MS SQL 2000 database like this: date('l jS \of F Y h:i:s A') So the text

RE: [PHP] Date Conversion Problem

2010-06-17 Thread David Stoltz
...not to mention I'm a newbie, so that doesn't help ;-) Thanks! -Original Message- From: Richard Quadling [mailto:rquadl...@gmail.com] Sent: Thursday, June 17, 2010 8:47 AM To: David Stoltz Cc: a...@ashleysheridan.co.uk; php-general@lists.php.net Subject: Re: [PHP] Date Conversion Problem On 17

RE: [PHP] Date Conversion Problem

2010-06-17 Thread David Stoltz
To: David Stoltz Cc: a...@ashleysheridan.co.uk; php-general@lists.php.net Subject: Re: [PHP] Date Conversion Problem On 17 June 2010 13:40, David Stoltz dsto...@shh.org wrote: I would agree with you, but I have no control on inherited web apps. I now need to concentrate on trying to fix

Re: [PHP] Date Conversion Problem

2010-06-17 Thread Shreyas Agasthya
: Thursday, June 17, 2010 8:47 AM To: David Stoltz Cc: a...@ashleysheridan.co.uk; php-general@lists.php.net Subject: Re: [PHP] Date Conversion Problem On 17 June 2010 13:40, David Stoltz dsto...@shh.org wrote: I would agree with you, but I have no control on inherited web apps. I now need

Re: [PHP] Date Math

2010-04-21 Thread Michiel Sikma
On 20 April 2010 17:40, Floyd Resler fres...@adex-intl.com wrote: I need to get the difference in months between two dates. The dates could be as much as 60 months apart. Is there any easy way to do this either through PHP or MySQL? I know how I can do it through code but thought there

Re: [PHP] Date Math

2010-04-21 Thread Floyd Resler
On Apr 21, 2010, at 5:39 AM, Michiel Sikma wrote: On 20 April 2010 17:40, Floyd Resler fres...@adex-intl.com wrote: I need to get the difference in months between two dates. The dates could be as much as 60 months apart. Is there any easy way to do this either through PHP or MySQL? I

Re: [PHP] Date Math

2010-04-20 Thread Dan Joseph
On Tue, Apr 20, 2010 at 11:40 AM, Floyd Resler fres...@adex-intl.comwrote: I need to get the difference in months between two dates. The dates could be as much as 60 months apart. Is there any easy way to do this either through PHP or MySQL? I know how I can do it through code but thought

Re: [PHP] Date Math

2010-04-20 Thread tedd
At 11:40 AM -0400 4/20/10, Floyd Resler wrote: I need to get the difference in months between two dates. The dates could be as much as 60 months apart. Is there any easy way to do this either through PHP or MySQL? I know how I can do it through code but thought there might be a simple one

Re: [PHP] Date Math

2010-04-20 Thread Paul M Foster
On Tue, Apr 20, 2010 at 03:32:58PM -0400, tedd wrote: At 11:40 AM -0400 4/20/10, Floyd Resler wrote: I need to get the difference in months between two dates. The dates could be as much as 60 months apart. Is there any easy way to do this either through PHP or MySQL? I know how I can do it

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-09-03 Thread Stuart
2009/9/3 J DeBord jasdeb...@gmail.com: 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

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 jasdeb...@gmail.com: 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

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 +30 comparison

2009-09-02 Thread Ford, Mike
-Original Message- From: tedd [mailto:tedd.sperl...@gmail.com] Sent: 01 September 2009 21:52 At 2:47 PM -0400 9/1/09, Andrew Ballard wrote: On Tue, Sep 1, 2009 at 1:27 PM, teddtedd.sperl...@gmail.com wrote: First get the date to seconds, like so: $today_date = '8/26/2009';

RE: [PHP] Date +30 comparison

2009-09-02 Thread tedd
At 4:06 PM +0100 9/2/09, Ford, Mike wrote: -Original Message- From: tedd [mailto:tedd.sperl...@gmail.com] Sent: 01 September 2009 21:52 At 2:47 PM -0400 9/1/09, Andrew Ballard wrote: On Tue, Sep 1, 2009 at 1:27 PM, teddtedd.sperl...@gmail.com wrote: First get the date to

Re: [PHP] Date +30 comparison

2009-09-01 Thread Ashley Sheridan
On Tue, 2009-09-01 at 12:19 -0400, David Stoltz wrote: I'm really struggling with dates in PHP. (Yes, I tried reading the manual)... Can someone provide code that does this: Takes current date, assigns it to a variable (let's say $today) Then adds 30 days to $today variable Takes a

Re: [PHP] Date +30 comparison

2009-09-01 Thread Dan Shirah
I'm really struggling with dates in PHP. (Yes, I tried reading the manual)... Can someone provide code that does this: Takes current date, assigns it to a variable (let's say $today) Then adds 30 days to $today variable Takes a string ($nexteval) like '8/26/2009' and compare it to $today.

Re: [PHP] Date +30 comparison

2009-09-01 Thread kranthi
i prefer http://in3.php.net/strtotime it supports loads of other formats as well (including +30 days and 8/26/2009) above all it returns unix time stamp which can be used directly with date(). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Date +30 comparison

2009-09-01 Thread tedd
At 5:43 PM +0100 9/1/09, Ashley Sheridan wrote: On Tue, 2009-09-01 at 12:19 -0400, David Stoltz wrote: I'm really struggling with dates in PHP. (Yes, I tried reading the manual)... Can someone provide code that does this: Takes current date, assigns it to a variable (let's say $today)

RE: [PHP] Date +30 comparison

2009-09-01 Thread David Stoltz
: Re: [PHP] Date +30 comparison On Tue, 2009-09-01 at 12:19 -0400, David Stoltz wrote: I'm really struggling with dates in PHP. (Yes, I tried reading the manual)... Can someone provide code that does this: Takes current date, assigns it to a variable (let's say $today) Then adds 30 days

RE: [PHP] Date +30 comparison

2009-09-01 Thread tedd
At 1:28 PM -0400 9/1/09, David Stoltz wrote: Ok, this is how I finally managed to get it to work - I'm sure there are other ways, but this works: //Check to make sure the next eval date is more than 30 days away $d1 = date('Y-m-d', strtotime($todays_date . '+30 day')); $d2 = date('Y-m-d',

Re: [PHP] Date +30 comparison

2009-09-01 Thread Andrew Ballard
On Tue, Sep 1, 2009 at 1:27 PM, teddtedd.sperl...@gmail.com wrote: First get the date to seconds, like so: $today_date = '8/26/2009'; $next_date = strtotime($today_date) + (86400 * 30); No. Due to Daylight Saving Time, many time zones have two days each year when the number of seconds in a

Re: [PHP] Date +30 comparison

2009-09-01 Thread Paul M Foster
On Tue, Sep 01, 2009 at 02:47:43PM -0400, Andrew Ballard wrote: On Tue, Sep 1, 2009 at 1:27 PM, teddtedd.sperl...@gmail.com wrote: First get the date to seconds, like so: $today_date = '8/26/2009'; $next_date = strtotime($today_date) + (86400 * 30); No. Due to Daylight Saving

Re: [PHP] Date +30 comparison

2009-09-01 Thread tedd
At 2:47 PM -0400 9/1/09, Andrew Ballard wrote: On Tue, Sep 1, 2009 at 1:27 PM, teddtedd.sperl...@gmail.com wrote: First get the date to seconds, like so: $today_date = '8/26/2009'; $next_date = strtotime($today_date) + (86400 * 30); No. Due to Daylight Saving Time, many time zones have

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 Stuart
2009/8/28 David Stoltz dsto...@shh.org: 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,

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

RE: [PHP] Date Comparison

2009-08-28 Thread David Stoltz
[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 dsto...@shh.org: How to I ensure a variable date is not in the past, compared to the current date? Here's how I'm trying

Re: [PHP] date time late or lagging RESOLVED

2009-04-28 Thread Andrew Williams
On Tue, Apr 28, 2009 at 3:45 PM, Andrew Williams andrew4willi...@gmail.comwrote: hi all, $dateNow = date('Y-m-d H:i:s'); echo pstrong.$dateNow ./strong/p; can some see why the date time is lagging or late by 30 minutes from the server time even when server time are correct -- Best

Re: [PHP] DATE / strtotime

2009-04-19 Thread Chris
Ron Piggott wrote: Where $date_reference is 2009-04-18 the following code gives me a day of 1969-12-30. How do I get it to be 2009-04-17? $previous_date = strtotime(-1 days, $date_reference); $previous_date = date('Y-m-d', $previous_date); Slightly wrong syntax. $previous_date =

Re: [PHP] DATE / strtotime

2009-04-19 Thread Jim Lucas
Ron Piggott wrote: Where $date_reference is 2009-04-18 the following code gives me a day of 1969-12-30. How do I get it to be 2009-04-17? $previous_date = strtotime(-1 days, $date_reference); $previous_date = date('Y-m-d', $previous_date); echo $previous_date; outputs 1969-12-30 Ron

Re: [PHP] DATE / strtotime

2009-04-19 Thread Ron Piggott
Thanks Chris. It has been a while since I used this command. Ron On Mon, 2009-04-20 at 13:27 +1000, Chris wrote: Ron Piggott wrote: Where $date_reference is 2009-04-18 the following code gives me a day of 1969-12-30. How do I get it to be 2009-04-17? $previous_date = strtotime(-1

Re: [PHP] Date Issue

2008-11-18 Thread Andrew Ballard
-general@lists.php.net Subject: Re: [PHP] Date Issue Boyd, Todd M. wrote: Are you sure this isn't like Javascript's getMonth function? Its index may begin at 0, making day 0 the first day of the year. Hmm, though I know us programmers love to start counting at zero, why would

Re: [PHP] Date Issue

2008-11-18 Thread Ashley Sheridan
, 2008 4:50 PM To: Boyd, Todd M. Cc: [EMAIL PROTECTED]; php-general@lists.php.net Subject: Re: [PHP] Date Issue Boyd, Todd M. wrote: Are you sure this isn't like Javascript's getMonth function? Its index may begin at 0, making day 0 the first day of the year. Hmm, though

Re: [PHP] Date Issue

2008-11-18 Thread Andrew Ballard
On Tue, Nov 18, 2008 at 2:58 PM, Ashley Sheridan [EMAIL PROTECTED] wrote: It just flew in the face of all I knew at the time to have a non-associative system-generated array (by that I mean one whos keys are integars and not string keys) that doesn't start at 0. No other arrays defined in

RE: [PHP] Date Issue

2008-11-17 Thread Boyd, Todd M.
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2008 10:50 AM To: php-general@lists.php.net Subject: [PHP] Date Issue $smont = 10; $sday = 13; $syear = 2008; $timestamp = mktime(0,0,0,$smont,$sday,$syear); $thismonth =

Re: [PHP] Date Issue

2008-11-17 Thread Nathan Rixham
Boyd, Todd M. wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2008 10:50 AM To: php-general@lists.php.net Subject: [PHP] Date Issue $smont = 10; $sday = 13; $syear = 2008; $timestamp = mktime(0,0,0,$smont,$sday,$syear); $thismonth =

Re: [PHP] Date Issue

2008-11-17 Thread Craige Leeder
Boyd, Todd M. wrote: Are you sure this isn't like Javascript's getMonth function? Its index may begin at 0, making day 0 the first day of the year. HTH, Todd Boyd Web Programmer Hmm, though I know us programmers love to start counting at zero, why would something as static as a date

RE: [PHP] Date Issue

2008-11-17 Thread Boyd, Todd M.
-Original Message- From: Craige Leeder [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2008 4:50 PM To: Boyd, Todd M. Cc: [EMAIL PROTECTED]; php-general@lists.php.net Subject: Re: [PHP] Date Issue Boyd, Todd M. wrote: Are you sure this isn't like Javascript's getMonth

RE: [PHP] Date Issue

2008-11-17 Thread Ashley Sheridan
On Mon, 2008-11-17 at 16:57 -0600, Boyd, Todd M. wrote: -Original Message- From: Craige Leeder [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2008 4:50 PM To: Boyd, Todd M. Cc: [EMAIL PROTECTED]; php-general@lists.php.net Subject: Re: [PHP] Date Issue Boyd, Todd M

  1   2   3   4   5   6   7   8   >