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 t

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 a écrit : > >> On 10/6/2013 7:55 PM, Ashley Sheridan wrote: >>> On Sun, 2013-10-06 at 19:14 -0400, Aziz Saleh wrote: >>> >>> Jim, >>> >>> T

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

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

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 linkJonathan sent out

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 wrote: > Jim, > > The date method takes in a timestamp (not seconds away). > > You have the seconds, you will need to man

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 wrote: > Its so freaky > > Best Reg

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" wrote: > Its so freaky > > Best Regards > Farzan Dalaee > > > On Oct 7, 2013, at 2:29, Jim Giner wrote: > > > >> On 10/6/2013 6:49 PM, Farzan Da

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 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 wrote: On 10

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

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 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); >> >> Best Rega

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 wrote: I always hate dealing with date/time stuff in php - never get it even clos

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 wrote: > > I always hate dealing with date/time stuff in php - never get it even close > until an hour or two goes by >

[PHP] date time problem

2013-10-06 Thread Jim Giner
I always hate dealing with date/time stuff in php - never get it even close until an hour or two goes by anyway I have this: // get two timestamp values $exp_time = $_COOKIE[$applid."expire"]; $curr_time = time(); // get the difference $diff = $exp_time - $curr_time; // produce a display t

Re: [PHP] Date weirdness

2013-04-18 Thread Larry Martell
On Thu, Mar 28, 2013 at 3:40 PM, Larry Martell wrote: > On Thu, Mar 28, 2013 at 2:44 PM, Steven Staples 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 som

Re: [PHP] Date weirdness

2013-03-28 Thread Larry Martell
On Thu, Mar 28, 2013 at 4:55 PM, Maciek Sokolewicz wrote: > On 28-3-2013 22:40, Larry Martell wrote: >> >> On Thu, Mar 28, 2013 at 2:44 PM, Steven Staples 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. A

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

Re: [PHP] Date weirdness

2013-03-28 Thread Larry Martell
On Thu, Mar 28, 2013 at 2:44 PM, Steven Staples 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 is from a

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

[PHP] Date weirdness

2013-03-28 Thread Larry Martell
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 example ce

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 Gener

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

Re: [PHP] date problem

2013-01-03 Thread Jonathan Sundquist
23'; > if(strtotime<http://www.php.net/strtotime>($dateA) > strtotime< > http://www.php.net/strtotime>($dateB)){ > // bla bla > } > > Thanks > > > From: Serge Fonville [mailto:serge.fonvi...@gmail.com] > Sent: Thursday, January 03, 2013 2:05 PM

RE: [PHP] date problem

2013-01-03 Thread Marc Fromm
onvi...@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 than HTH Kind regards/met vriendelijke groet, Serge Fonville http://www.serge

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

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 https://connect.microsoft.com/SQLServer/feedback/det

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 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 = " M

[PHP] date problem

2013-01-03 Thread Marc Fromm
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 is being assigned inside the if st

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 manipulation

2012-10-25 Thread Daniel Brown
On Thu, Oct 25, 2012 at 3:06 PM, Ron Piggott 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. -- Network Infrastructure Manager http://www.php.

[PHP] Date manipulation

2012-10-25 Thread Ron Piggott
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 Ron Ron Piggott www.TheVerseOfTheDay.info

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: Terry On 2 May 2012 22:36, Haluk Karamete wrote: > This is my code and the output is right after that... > > $PDate = $row['PDate']; > //row is tapping into ms-sq

Re: [PHP] date conversion/extraction issues

2012-05-02 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 "[", $PDate , "]"; echo "

Re: [PHP] date conversion/extraction issues

2012-05-02 Thread Matijn Woudt
On Wed, May 2, 2012 at 11: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 "[

[PHP] date conversion/extraction issues

2012-05-02 Thread Haluk Karamete
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 "[", $PDate , "]"; echo "[", var_dump($row['PDate']) , "]"; echo "[", ser

Re: [PHP] date() confustion

2012-04-26 Thread ma...@behnke.biz
Nathan Nobbe 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 22:29:21 > > I g

Re: [PHP] date() confustion

2012-04-25 Thread Nathan Nobbe
On Wed, Apr 25, 2012 at 10:44 PM, Simon J Welsh 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 working on

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(

[PHP] date() confustion

2012-04-25 Thread Nathan Nobbe
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 G:i:s", $timestamp); Logging these values yields: INSERT

Re: [PHP] Date function kill lots time !

2012-01-05 Thread xucheng
yes,it is set in php.ini . 2012/1/5 Adam Richardson > On Wed, Jan 4, 2012 at 11:07 PM, xucheng 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

Re: [PHP] Date function kill lots time !

2012-01-04 Thread Adam Richardson
On Wed, Jan 4, 2012 at 11:07 PM, xucheng 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 ? Is this function ha

[PHP] Date function kill lots time !

2012-01-04 Thread xucheng
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 ? Is this function has some internal issue that i should kown ? Any comment a

[PHP] Date validation

2011-05-20 Thread Geoff Lane
Hi All, I'm scratching my head trying to remember how I validated string representation of dates 'the first time around' with PHP (before going over to ASP/VBScript for almost a decade). I have a feeling that I must have rolled my own validation function, because I can't find anything other than s

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: 31-12-1

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

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 fir

Re: [PHP] date problem

2011-04-01 Thread Daniel Brown
On Fri, Apr 1, 2011 at 12:35, Dan Dan wrote: > Hi Folks, > > I am trying to get the day of month for a particular day of week (e.g. > Tuesday) for the first, second, third, fourth week in a month. The code i > have seems issues in March, but works e.g. in April: > > print date("d-m-Y H:i:s",strtot

[PHP] date problem

2011-04-01 Thread Dan Dan
Hi Folks, I am trying to get the day of month for a particular day of week (e.g. Tuesday) for the first, second, third, fourth week in a month. The code i have seems issues in March, but works e.g. in April: print date("d-m-Y H:i:s",strtotime('1 March 2011 Tuesday')); >> 01-03-2011 00:00:00 prin

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 proc

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 a

[PHP] Date Test...

2010-07-07 Thread Don Wieland
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 identified with: $ffield['s']=='/' I tried to add the "&& !emp

RE: [PHP] Date Conversion Problem

2010-06-18 Thread David Stoltz
oldDate = replace(oldDate,"August ","8/") oldDate = replace(oldDate,"September ","9/") oldDate = replace(oldDate,"October ","10/") oldDate = replace(oldDate,"November ",&qu

Re: [PHP] Date Conversion Problem

2010-06-17 Thread Shreyas Agasthya
[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 June 2010 13:40, David Stoltz wrote: > > I would agree with you, but I have no c

RE: [PHP] Date Conversion Problem

2010-06-17 Thread David Stoltz
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 wrote: > I would agree with you, but I have no control on inherited web apps. > > > > I now need to concentrate o

RE: [PHP] Date Conversion Problem

2010-06-17 Thread David Stoltz
people's stuff...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

Re: [PHP] Date Conversion Problem

2010-06-17 Thread Richard Quadling
010 8:38 AM > To: David 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 int

Re: [PHP] Date Conversion Problem

2010-06-17 Thread Richard Quadling
On 17 June 2010 13:40, Richard Quadling wrote: > On 17 June 2010 13:35, 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

Re: [PHP] Date Conversion Problem

2010-06-17 Thread Richard Quadling
On 17 June 2010 13:35, 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 > > > > The

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

[PHP] Date Conversion Problem

2010-06-17 Thread David Stoltz
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 database field is defined as varchar, not datetime...so it's a str

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

Re: [PHP] Date Math

2010-04-21 Thread Michiel Sikma
On 20 April 2010 17:40, 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

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 or

Re: [PHP] Date Math

2010-04-20 Thread Dan Joseph
On Tue, Apr 20, 2010 at 11:40 AM, 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 s

[PHP] Date Math

2010-04-20 Thread Floyd Resler
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 or two line option. Thanks! Floyd -- PHP Genera

Re: [PHP] Re: intermittent failure of php date

2010-01-18 Thread Ashley Sheridan
On Mon, 2010-01-18 at 10:32 -0500, John Corry wrote: > The field in the DB is defined as type date. > > I've had several event registrations for an upcoming event come through. THe > event date is '2010-01-27'. > > 2 of the 5 event registrations contained empty values for the date. > > wtf? >

[PHP] Re: intermittent failure of php date

2010-01-18 Thread John Corry
The field in the DB is defined as type date. I've had several event registrations for an upcoming event come through. THe event date is '2010-01-27'. 2 of the 5 event registrations contained empty values for the date. wtf? On Mon, Jan 18, 2010 at 10:23 AM, John Corry wrote: > I maintain a sit

[PHP] intermittent failure of php date

2010-01-18 Thread John Corry
I maintain a site that is generating some strange behavior... It's a custom built event registration app. Events have event_dates that are stored in the MySQL db. This code retrieves the event title and event date for display on the registration acknowledgment page: $q2 = "SELECT title, event_d

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 +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, tedd wrote: >> First get the date to seconds, like so: >> >

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, tedd > wrote: > >> First get the date to seconds, like so: > >> > >> $today_date = '8/26/2009'; > >> >

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

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, tedd 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 ti

Re: [PHP] Date +30 comparison

2009-09-01 Thread Andrew Ballard
On Tue, Sep 1, 2009 at 1:27 PM, tedd 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 day is not 86400.

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', strto

RE: [PHP] Date +30 comparison

2009-09-01 Thread David Stoltz
vid Stoltz Cc: php-general@lists.php.net Subject: 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 c

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

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

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

  1   2   3   4   5   6   7   8   9   10   >