[PHP] strtotime

2010-10-16 Thread John Taylor-Johnston
$now=date("Y-m-d"); A = $mydata->birthday = 1928-02-12; B = $mydata->birthday = 1965-03-18; C = $mydata->birthday = 1976-04-11; I'm doing a demographic sort. How do I calculate whether $mydata->Birthday falls into these categories below? I'm working my way right now through the manual: http:/

Re: [PHP] strtotime()

2010-08-23 Thread Daniel Brown
On Tue, Aug 24, 2010 at 00:37, Rick Pasotto wrote: > > http://us2.php.net/manual/en/datetime.formats.relative.php Thank you, sir! -- UNADVERTISED DEDICATED SERVER SPECIALS SAME-DAY SETUP Just ask me what we're offering today! daniel.br...@parasane.net || danbr...@php.net http://www.parasan

Re: [PHP] strtotime()

2010-08-23 Thread Rick Pasotto
On Mon, Aug 23, 2010 at 11:38:41PM -0400, Daniel P. Brown wrote: > On Mon, Aug 23, 2010 at 22:27, Rick Pasotto wrote: > > > > After I sent my original post the one and only user comment on the > > relative date strings man page was pointed out to me. So, it's there but > > how many people make a h

Re: [PHP] strtotime()

2010-08-23 Thread Daniel P. Brown
On Mon, Aug 23, 2010 at 22:27, Rick Pasotto wrote: > > After I sent my original post the one and only user comment on the > relative date strings man page was pointed out to me. So, it's there but > how many people make a habit of reading all the user comments? A few thousand per day, give or

Re: [PHP] strtotime()

2010-08-23 Thread Rick Pasotto
On Mon, Aug 23, 2010 at 05:57:28PM -0400, Daniel Brown wrote: > On Mon, Aug 23, 2010 at 17:02, Ashley Sheridan > wrote: > > > > The example you quote as being straight from the manual page is actually > > from the user-submitted code snippets, and I can't find the > > documentation to support it.

Re: [PHP] strtotime()

2010-08-23 Thread Daniel Brown
On Mon, Aug 23, 2010 at 17:02, Ashley Sheridan wrote: > > The example you quote as being straight from the manual page is actually > from the user-submitted code snippets, and I can't find the > documentation to support it. I can only assume that it's possibly an > experimental thing, or somethin

Re: [PHP] strtotime()

2010-08-23 Thread Ashley Sheridan
On Mon, 2010-08-23 at 16:04 -0400, Rick Pasotto wrote: > On my home machine running 5.3.2-2 in debian linux the commands: > > echo date('Y-m-d',strtotime('first day of this month')).''; > echo date('Y-m-d',strtotime('last day of next month')); > > give the expected results. > > I just got setup

[PHP] strtotime()

2010-08-23 Thread Rick Pasotto
On my home machine running 5.3.2-2 in debian linux the commands: echo date('Y-m-d',strtotime('first day of this month')).''; echo date('Y-m-d',strtotime('last day of next month')); give the expected results. I just got setup with a hosting provider running 5.2.13 on BSD and both give '1969-12-31

Re: [PHP] strtotime woes

2010-05-05 Thread Philip Thompson
On May 5, 2010, at 10:12 AM, Peter Lind wrote: > On 5 May 2010 16:58, Philip Thompson wrote: >> Hello all. >> >> Long time no see! Anyway, I'm having an issue with strtotime(). Why do the >> following return valid timestamps? >> >> > echo strtotime ('a').': '.date ("m/d/Y", strtotime ('a')).""

Re: [PHP] strtotime woes

2010-05-05 Thread Peter Lind
On 5 May 2010 16:58, Philip Thompson wrote: > Hello all. > > Long time no see! Anyway, I'm having an issue with strtotime(). Why do the > following return valid timestamps? > > echo strtotime ('a').': '.date ("m/d/Y", strtotime ('a')).""; > echo strtotime ('a,a').': '.date ("m/d/Y", strtotime ('

[PHP] strtotime woes

2010-05-05 Thread Philip Thompson
Hello all. Long time no see! Anyway, I'm having an issue with strtotime(). Why do the following return valid timestamps? "; echo strtotime ('a,a').': '.date ("m/d/Y", strtotime ('a,a')).""; echo strtotime ('a,a,a').': '.date ("m/d/Y", strtotime ('a,a,a')).""; ?> These result in today's date: 1

RE: [PHP] strtotime

2010-01-15 Thread Bob McConnell
Sent: Thursday, January 14, 2010 4:14 PM To: php-general@lists.php.net Subject: Re: [PHP] strtotime On Thu, Jan 14, 2010 at 2:53 PM, Adam Richardson wrote: > I've not read this, but if the first valid date is Jan. 1st, 1970, then > passing that date back in the case of errors would lead

Re: [PHP] strtotime

2010-01-14 Thread John Taylor-Johnston
My thanks to all! Adam Richardson wrote: I've not read this, but if the first valid date is Jan. 1st, 1970, then passing that date back in the case of errors would lead to ambiguity. Is it a valid date or is it an error. Passing back the date of the day just before (in terms of time, I think

Re: [PHP] strtotime

2010-01-14 Thread haliphax
On Thu, Jan 14, 2010 at 2:53 PM, Adam Richardson wrote: > I've not read this, but if the first valid date is Jan. 1st, 1970, then > passing that date back in the case of errors would lead to ambiguity. Is > it > a valid date or is it an error. Passing back the date of the day just > before (in t

Re: [PHP] strtotime

2010-01-14 Thread Adam Richardson
I've not read this, but if the first valid date is Jan. 1st, 1970, then passing that date back in the case of errors would lead to ambiguity. Is it a valid date or is it an error. Passing back the date of the day just before (in terms of time, I think it's the second before) the first valid date

Re: [PHP] strtotime

2010-01-14 Thread Kim Madsen
Hi guys I have a question: Ashley Sheridan wrote on 14/01/2010 19:20: MySQL uses a default "-00-00" value for date fields generally, but when converted into a timestamp, the string equates to a false value. In PHP, timestamps are numerical values indicating the seconds since Midnight of the

Re: [PHP] strtotime

2010-01-14 Thread Adam Richardson
When you set the date to "-00-00", you start the following sequence: 1. strtotime returns false, because "-00-00" isn't a date it can parse into a timestamp. 2. date returns 1969, because it's not passed a valid timestamp and it works from December 31, 1969 for any invalid dat

Re: [PHP] strtotime

2010-01-14 Thread Ashley Sheridan
On Thu, 2010-01-14 at 13:14 -0500, John Taylor-Johnston wrote: > Hello, > > In a mysql date() field, I set the default to "-00-00". > > Therefore, $mydata->birthday = "-00-00"; > > But when I run this next line, $then = 1969. > > $then=date("Y", strtotime($mydata->birthday)); > > Why

[PHP] strtotime

2010-01-14 Thread John Taylor-Johnston
Hello, In a mysql date() field, I set the default to "-00-00". Therefore, $mydata->birthday = "-00-00"; But when I run this next line, $then = 1969. $then=date("Y", strtotime($mydata->birthday)); Why 1969, and not 0 or nothing? If I echo strtotime("-00-00"); Nothing appears. So

Re: [PHP] strtotime - assumptions about default formatting of dates

2010-01-04 Thread Pete Ford
On 24/12/09 16:59, Bastien Koert wrote: On Thu, Dec 24, 2009 at 9:12 AM, tedd wrote: At 10:20 PM +1000 12/24/09, Angus Mann wrote: Hi all. I need to allow users to enter dates and times, and for a while now I've been forcing them to use javascript date/time pickers so I can be absolutely sure

Re: [PHP] strtotime - assumptions about default formatting of dates

2009-12-24 Thread Bastien Koert
On Thu, Dec 24, 2009 at 9:12 AM, tedd wrote: > At 10:20 PM +1000 12/24/09, Angus Mann wrote: >> >> Hi all. I need to allow users to enter dates and times, and for a while >> now I've been forcing them to use javascript date/time pickers so I can be >> absolutely sure the formatting is correct. >>

Re: [PHP] strtotime - assumptions about default formatting of dates

2009-12-24 Thread tedd
At 10:20 PM +1000 12/24/09, Angus Mann wrote: Hi all. I need to allow users to enter dates and times, and for a while now I've been forcing them to use javascript date/time pickers so I can be absolutely sure the formatting is correct. Some users are requesting to be able to type the entries t

Re: [PHP] strtotime - assumptions about default formatting of dates

2009-12-24 Thread Daniel Egeberg
On Thu, Dec 24, 2009 at 13:20, Angus Mann wrote: > Hi all. I need to allow users to enter dates and times, and for a while now > I've been forcing them to use javascript date/time pickers so I can be > absolutely sure the formatting is correct. > > Some users are requesting to be able to type th

[PHP] strtotime - assumptions about default formatting of dates

2009-12-24 Thread Angus Mann
Hi all. I need to allow users to enter dates and times, and for a while now I've been forcing them to use javascript date/time pickers so I can be absolutely sure the formatting is correct. Some users are requesting to be able to type the entries themselves so I've decided to allow this. I'm i

Re: [PHP] strtotime strangeness

2009-10-05 Thread Daniel Brown
On Mon, Oct 5, 2009 at 12:15, Jim Lucas wrote: > > You stated that you are running PHP 5.2.10 , too bad the function recommend > (locale_get_default()) is only available in PHP 5.3 or newer. That's my fault entirely, not Floyd's. I didn't look to see what version of PHP he was running. --

Re: [PHP] strtotime strangeness

2009-10-05 Thread Jim Lucas
Floyd Resler wrote: > Well that's odd. locale_get_default() gave me an undefined function > error. Apparently this year problem has been reported as a bug on > bugs.php.net but the status for it (and everything else) is Bogus. I'm > not sure if that means anything or not but hopefully a fix wil

Re: [PHP] strtotime strangeness

2009-10-05 Thread Floyd Resler
Well that's odd. locale_get_default() gave me an undefined function error. Apparently this year problem has been reported as a bug on bugs.php.net but the status for it (and everything else) is Bogus. I'm not sure if that means anything or not but hopefully a fix will be coming soon. Th

Re: [PHP] strtotime strangeness

2009-10-05 Thread Daniel Brown
On Sun, Oct 4, 2009 at 17:00, Floyd Resler wrote: > Sorry to hear that!  I live in Cincinnati so I normally don't get to watch > the Colts play when they are on at the same time as the Bengals.  But this > week I did and, best of all, they won! Yeah, well, the Browns sure didn't, so bite me.

Re: [PHP] strtotime strangeness

2009-10-04 Thread Floyd Resler
Sorry to hear that! I live in Cincinnati so I normally don't get to watch the Colts play when they are on at the same time as the Bengals. But this week I did and, best of all, they won! On Oct 4, 2009, at 3:24 PM, Eddie Drapkin wrote: On Sun, Oct 4, 2009 at 3:22 PM, Floyd Resler wrote:

Re: [PHP] strtotime strangeness

2009-10-04 Thread Eddie Drapkin
On Sun, Oct 4, 2009 at 3:22 PM, Floyd Resler wrote: > Yeah, the ;Y" was a typo in my email.  That's what happens while trying to > type while watching my Colts play! > > Thanks! > Floyd > Go Colts! At least you get to watch it, I have to follow along on sports sites! -- PHP General Mailing List

Re: [PHP] strtotime strangeness

2009-10-04 Thread Floyd Resler
n, October 4, 2009 12:01:30 PM Subject: Re: [PHP] strtotime strangeness I couldn't find anything in the php.ini file to account for this. I am running PHP 5.2.10. I've never actually updated it myself so the software updater updated it at some point. I did a little test and fo

Re: [PHP] strtotime strangeness

2009-10-04 Thread Tommy Pham
- Original Message > From: Floyd Resler > To: Andrea Giammarchi > Cc: php-general@lists.php.net > Sent: Sun, October 4, 2009 12:01:30 PM > Subject: Re: [PHP] strtotime strangeness > > I couldn't find anything in the php.ini file to account for this. I a

Re: [PHP] strtotime strangeness

2009-10-04 Thread Floyd Resler
x-intl.com > To: php-general@lists.php.net > Date: Sun, 4 Oct 2009 14:05:05 -0400 > Subject: [PHP] strtotime strangeness > > For some reason the strtotime is no longer returning the year > portion. For example, strtotime("10/04/2009") will result in a date > of -10-0

RE: [PHP] strtotime strangeness

2009-10-04 Thread Andrea Giammarchi
Did the OS update changed the default locale settings or the default date format? > From: fres...@adex-intl.com > To: php-general@lists.php.net > Date: Sun, 4 Oct 2009 14:05:05 -0400 > Subject: [PHP] strtotime strangeness > > For some reason the strtotime is no longer

[PHP] strtotime strangeness

2009-10-04 Thread Floyd Resler
For some reason the strtotime is no longer returning the year portion. For example, strtotime("10/04/2009") will result in a date of -10-04. This started happening recently and I haven't done any updates other than the normal OS updates. I am running Mac OS X 10.5.8. Does anyone hav

[PHP] strtotime

2008-11-08 Thread gilles
Avec la version 4 de php, strtotime("20080950") fonctionne correctement en allant sur le mois d'octobre, alors qu'en version 5: 19700101. Merci de votre aide -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] strtotime problem

2008-10-10 Thread Thodoris Goltsios
Greetings, Thodoris. In reply to Your message dated Wednesday, October 8, 2008, 16:35:40, Greetings to you too :-) . From your function name I assume you want to use it in MySQL. In that case, why don't you have MySQL do all the magic for you? eg. INSERT INTO table (col) VALUES (FROM_UNI

Re[2]: [PHP] strtotime problem

2008-10-10 Thread ANR Daemon
Greetings, Thodoris. In reply to Your message dated Wednesday, October 8, 2008, 16:35:40, >> From your function name I assume you want to use it in MySQL. In that >> case, why don't you have MySQL do all the magic for you? >> eg. INSERT INTO table (col) VALUES (FROM_UNIXTIME($timestamp)); >> (usi

Re: [PHP] strtotime problem

2008-10-08 Thread Thodoris
From your function name I assume you want to use it in MySQL. In that case, why don't you have MySQL do all the magic for you? eg. INSERT INTO table (col) VALUES (FROM_UNIXTIME($timestamp)); (using FROM_UNIXTIME($timestamp) will give you the date-time in "mysql format" (-MM-DD HH:MM:SS)

Re: [PHP] strtotime problem

2008-10-08 Thread Maciek Sokolewicz
Thodoris wrote: Actually strtotime accepts all kinds of things... "Last week Thursday midnight" for example works perfectly. You could do an explode on the field and then reorder the array anyway that you want... Or something like that :) That wasn't tested but should give you an idea

Re: [PHP] strtotime problem

2008-10-08 Thread Jason Pruim
On Oct 8, 2008, at 7:58 AM, Thodoris wrote: Actually strtotime accepts all kinds of things... "Last week Thursday midnight" for example works perfectly. You could do an explode on the field and then reorder the array anyway that you want... Or something like that :) That wasn't te

Re: [PHP] strtotime problem

2008-10-08 Thread Stut
On 8 Oct 2008, at 12:58, Thodoris wrote: Actually this means that strtotime() was made with Americans *only* in mind... :-) . As far as I know it uses the configured timezone to decide between ambiguous formats. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/)

Re: [PHP] strtotime problem

2008-10-08 Thread Thodoris
Actually strtotime accepts all kinds of things... "Last week Thursday midnight" for example works perfectly. You could do an explode on the field and then reorder the array anyway that you want... Or something like that :) That wasn't tested but should give you an idea... php.net/expl

Re: [PHP] strtotime problem

2008-10-08 Thread Jason Pruim
On Oct 8, 2008, at 7:08 AM, Thodoris wrote: I know that *strtotime*() only recognises the formats mm/dd/, -mm-dd and mmdd for numeric months but I need do something like that: function dateWebToMysql($webdate){ $format = 'Y-m-d'; $timestamp = strtotime($webda

Re: [PHP] strtotime problem

2008-10-08 Thread Jason Pruim
On Oct 8, 2008, at 7:24 AM, Thodoris wrote: On Oct 8, 2008, at 7:08 AM, Thodoris wrote: I know that *strtotime*() only recognises the formats mm/dd/, -mm-dd and mmdd for numeric months but I need do something like that: function dateWebToMysql($webdate){ $format = 'Y

Re: [PHP] strtotime problem

2008-10-08 Thread Thodoris
On Oct 8, 2008, at 7:08 AM, Thodoris wrote: I know that *strtotime*() only recognises the formats mm/dd/, -mm-dd and mmdd for numeric months but I need do something like that: function dateWebToMysql($webdate){ $format = 'Y-m-d'; $timestamp = strtotime($webdate);

[PHP] strtotime problem

2008-10-08 Thread Thodoris
I know that *strtotime*() only recognises the formats mm/dd/, -mm-dd and mmdd for numeric months but I need do something like that: function dateWebToMysql($webdate){ $format = 'Y-m-d'; $timestamp = strtotime($webdate); return date($format,$timestamp);

Re: [PHP] strtotime( 'last Sunday' ) and republicans

2008-03-13 Thread David Giragosian
On 3/13/08, tedd <[EMAIL PROTECTED]> wrote: > At 10:43 AM -0500 3/12/08, Greg Donald wrote: > >No matter where we draw the borders or put the roads and highways, > >it's still just the one planet, with the same finite resources we all > >have to share. Being mad about globalization is pointless, i

Re: [PHP] strtotime( 'last Sunday' ) and republicans

2008-03-13 Thread Robert Cummings
On Thu, 2008-03-13 at 11:49 -0400, tedd wrote: > At 10:43 AM -0500 3/12/08, Greg Donald wrote: > >No matter where we draw the borders or put the roads and highways, > >it's still just the one planet, with the same finite resources we all > >have to share. Being mad about globalization is pointles

Re: [PHP] strtotime( 'last Sunday' ) and republicans

2008-03-13 Thread tedd
At 10:43 AM -0500 3/12/08, Greg Donald wrote: No matter where we draw the borders or put the roads and highways, it's still just the one planet, with the same finite resources we all have to share. Being mad about globalization is pointless, it's inevitable. Not if you don't live on this plane

Re: [PHP] strtotime( 'last Sunday' ) and republicans

2008-03-12 Thread Greg Donald
On 3/10/08, Wolf <[EMAIL PROTECTED]> wrote: > Watch throwing that blame around there Greg, you get to thank the > democrats for NAFTA and the hurting the heartlands No matter where we draw the borders or put the roads and highways, it's still just the one planet, with the same finite resources we

Re: [PHP] strtotime( 'last Sunday' ) and republicans

2008-03-10 Thread Wolf
Greg Donald wrote: Hey Rob, Remember on 2007-09-18 at 22:45:37 when you suggested I do this: http://marc.info/?l=php-general&m=119015558426248&w=2 Well.. today strtotime( 'last Sunday' ) screwed me and I'm writing to say that I nearly fell out of my chair laughing when I realized what the pro

[PHP] strtotime( 'last Sunday' ) and republicans

2008-03-10 Thread Greg Donald
Hey Rob, Remember on 2007-09-18 at 22:45:37 when you suggested I do this: http://marc.info/?l=php-general&m=119015558426248&w=2 Well.. today strtotime( 'last Sunday' ) screwed me and I'm writing to say that I nearly fell out of my chair laughing when I realized what the problem was, who caused i

Re: [PHP] strtotime

2008-02-14 Thread Richard Lynch
I would use date and mktime, personally, as strtotime often does things I consider "strange" On Sun, February 10, 2008 5:46 am, Ron Piggott wrote: > > I am trying to calculate what was the date 18 months ago. When I give > the command: > > $18_months_ago = strtotime("-18 months"); > > It comes ba

Re: [PHP] strtotime

2008-02-10 Thread Ron Piggott
The date value I was assigning was for a mySQL query ... a date range query. I was running my query when I hadn't assigned a date to the other date range variable. I didn't realized I hadn't copied my DATE() syntax to this area of my code. Ron On Sun, 2008-02-10 at 18:22 +0100, Floor Terra wro

Re: [PHP] strtotime

2008-02-10 Thread Floor Terra
On 2/10/08, Ron Piggott <[EMAIL PROTECTED]> wrote: > I figured out what went wrong. Ron > Care to share it with us? Floor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] strtotime

2008-02-10 Thread Ron Piggott
I figured out what went wrong. Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] strtotime

2008-02-10 Thread Per Jessen
Ron Piggott wrote: > > I am trying to calculate what was the date 18 months ago. When I give > the command: > > $18_months_ago = strtotime("-18 months"); > > It comes back with: > > Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE That's a plain syntactical error, it's no

[PHP] strtotime

2008-02-10 Thread Ron Piggott
I am trying to calculate what was the date 18 months ago. When I give the command: $18_months_ago = strtotime("-18 months"); It comes back with: Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE How would you calculate 18 months ago from today? Ron -- PHP General Mailin

Re: [PHP] Strtotime returns 02/09/2008 for "next Saturday"....

2008-01-31 Thread Richard Lynch
On Thu, January 31, 2008 3:29 pm, Mike Morton wrote: > Except that generally, when am told "next Saturday" - I take that to > mean > "the next Saturday" - just one more ambiguity in the english language > that > makes it so hard to learn I suppose! strtotime has always seemed to me like it's borde

Re: [PHP] Strtotime returns 02/09/2008 for "next Saturday"....

2008-01-31 Thread Jochem Maas
Mike Morton schreef: Good point ;) Except that generally, when am told "next Saturday" - I take that to mean "the next Saturday" - just one more ambiguity in the english language that makes it so hard to learn I suppose! The odd thing about this whole situation it that it seems to have cropped

Re: [PHP] Strtotime returns 02/09/2008 for "next Saturday"....

2008-01-31 Thread Mike Morton
Good point ;) Except that generally, when am told "next Saturday" - I take that to mean "the next Saturday" - just one more ambiguity in the english language that makes it so hard to learn I suppose! The odd thing about this whole situation it that it seems to have cropped up just after we "upgra

Re: [PHP] Strtotime returns 02/09/2008 for "next Saturday"....

2008-01-31 Thread Richard Lynch
Maybe it's just me, but I've never quite figured out what people mean when they say "next Saturday"... Do they mean the next one coming up? Or do they mean that there's "this Saturday" coming up and "next Saturday" the one after that? And if I can't figure it out, why would you expect PHP to fig

Re: [PHP] Strtotime returns 02/09/2008 for "next Saturday"....

2008-01-31 Thread Tom Chubb
On 31/01/2008, Mike Morton <[EMAIL PROTECTED]> wrote: > > Ya - the other server is 4.4.7 > > However - this does not seem to be the problem necessarily: > > print date("m/d/Y",strtotime("next saturday")); > 02/09/2008 > > print date("m/d/Y",strtotime("next sunday")); > 02/10/2008 > > print date("m/

Re: [PHP] Strtotime returns 02/09/2008 for "next Saturday"....

2008-01-31 Thread Mike Morton
Ya - the other server is 4.4.7 However - this does not seem to be the problem necessarily: print date("m/d/Y",strtotime("next saturday")); 02/09/2008 print date("m/d/Y",strtotime("next sunday")); 02/10/2008 print date("m/d/Y",strtotime("next monday")); 02/11/2008 print date("m/d/Y",strtotime("

Re: [PHP] Strtotime returns 02/09/2008 for "next Saturday"....

2008-01-31 Thread Tom Chubb
On 31/01/2008, Mike Morton <[EMAIL PROTECTED]> wrote: > > I have been using: > > $nextSaturday= date("m/d/Y",strtotime("next saturday")); > > For months long time now with out problems, but in the last two days, it > went kind of funky. It is now returning: > > 02/09/2008 instead of the expected 0

[PHP] Strtotime returns 02/09/2008 for "next Saturday"....

2008-01-31 Thread Mike Morton
I have been using: $nextSaturday= date("m/d/Y",strtotime("next saturday")); For months long time now with out problems, but in the last two days, it went kind of funky. It is now returning: 02/09/2008 instead of the expected 02/02/2008. I have tried the same code on another server and differen

Re: [PHP] strtotime returns 00:00 for 7am

2007-06-21 Thread Greg Donald
On 6/20/07, Phil Princely <[EMAIL PROTECTED]> wrote: using this code: function test_time($time_string) { echo strftime("%X %A, %b %e\n", strtotime($time_string)); You should be testing the strtotime() call's return value, it returns false on failure. if (($timestamp = strtotime($str)) ===

[PHP] strtotime returns 00:00 for 7am

2007-06-20 Thread Phil Princely
Hi all I'm new to this list. I hope this hasn't been discussed already. using this code: function test_time($time_string) { echo strftime("%X %A, %b %e\n", strtotime($time_string)); } test_time('now'); test_time('4pm + 2 Hours'); test_time('now + 2 fortnights'); test_time('last Monday'); tes

Re: [PHP] strtotime

2006-10-25 Thread Google Kreme
On 24 Oct 2006, at 19:07 , Brad Chow wrote: $date=("2006-10-26"); $date=strtotime($date); $date=date('Y-m-1',$date); $now=strtotime("+3 month", strtotime($date)); $lastday=strtotime("-1 day", $now); echo date('Y-m-d',$lastday); //2006-12-31 Yep, that's pretty much exactly what I do. I suspect

Re: [PHP] strtotime

2006-10-25 Thread clive
Ron Piggott (PHP) wrote: I have used the strtotime command to calculate a week ago (among other things) with syntax like this: $one_week_ago = strtotime("-7 days"); $one_week_ago = date('Y-m-d', $one_week_ago); How would you use this command to figure out the last day of the month in two months

Re: [PHP] strtotime

2006-10-24 Thread Brad Chow
Dear Ron: I have a solution as follows: $date=("2006-10-26"); $date=strtotime($date); $date=date('Y-m-1',$date); $now=strtotime("+3 month", strtotime($date)); $lastday=strtotime("-1 day", $now); echo date('Y-m-d',$lastday); //2006-12-31 It's a very easy way to do you want. I use strtotime to co

Re: [PHP] strtotime

2006-10-24 Thread Chris
Ron Piggott (PHP) wrote: I have used the strtotime command to calculate a week ago (among other things) with syntax like this: $one_week_ago = strtotime("-7 days"); $one_week_ago = date('Y-m-d', $one_week_ago); How would you use this command to figure out the last day of the month in two months

[PHP] strtotime

2006-10-24 Thread Ron Piggott (PHP)
I have used the strtotime command to calculate a week ago (among other things) with syntax like this: $one_week_ago = strtotime("-7 days"); $one_week_ago = date('Y-m-d', $one_week_ago); How would you use this command to figure out the last day of the month in two months from now --- Today is Oct

[PHP] strtotime() strangeness

2006-09-04 Thread Paul Scott
I am trying to convert a date and time (from the apache2 server logs) in the format of 27/Aug/2006:19:02:20 +0200 to a UNIX timestamp and then reformat it as a RFC compliant date by using date('r', $thedate); My problem is as such. In PHP-5.1.2 it works perfectly and returns the correct date. In

Re: [PHP] strtotime('yesterday')

2005-05-25 Thread Burhan Khalid
Richard Lynch wrote: On Tue, May 24, 2005 7:24 am, Rahul S. Johari said: I¹m trying to delete all files in a folder based on a string match with the following code: Erase Successful!All images up to $date, have been permanently erased from the Server."; ?> I need the code to delete all images

Re: [PHP] strtotime('yesterday')

2005-05-24 Thread Richard Lynch
On Tue, May 24, 2005 7:24 am, Rahul S. Johari said: > I¹m trying to delete all files in a folder based on a string match with > the > following code: > > $dir = '/Library/WebServer/Documents/something.com/subfolder/'; > $dp = opendir($dir) or die ('Fatal Error: '.mysql_error()); > while ($file = r

[PHP] strtotime('yesterday')

2005-05-24 Thread Rahul S. Johari
Ave, I¹m trying to delete all files in a folder based on a string match with the following code: Erase Successful!All images up to $date, have been permanently erased from the Server."; ?> I need the code to delete all images created till yesterday, and leave images created today. Somehow strtot

Re: [PHP] strtotime() lost precision?

2005-04-26 Thread Jochem Maas
Mario de Frutos Dieguez wrote: Hi! I'm back hahaha :D I'm making functions to calculate the duration (only laboral days) between 2 dates and the initial and final date between a duration give me in laboral days. I use the following function to make the diference between 2 dates: function fecDife

[PHP] strtotime() lost precision?

2005-04-26 Thread Mario de Frutos Dieguez
Hi! I'm back hahaha :D I'm making functions to calculate the duration (only laboral days) between 2 dates and the initial and final date between a duration give me in laboral days. I use the following function to make the diference between 2 dates: function fecDiferenciaFechas($fecFechaInicio,$f

Re: [PHP] strtotime() bug?

2005-04-05 Thread Richard Lynch
On Mon, April 4, 2005 3:14 pm, Al said: > Suddenly my strtotime() are goofy, anyone have any ideas? > > echo date('Y/m/d/H', time()). ""; //2005/04/04/18 > echo date('Y/m/d/H', strtotime("-1 day")). ""; > //2005/04/03/18 > echo date('Y/m/d/H', strtotime("

[PHP] strtotime() bug?

2005-04-04 Thread Al
Suddenly my strtotime() are goofy, anyone have any ideas? echo date('Y/m/d/H', time()). ""; //2005/04/04/18 echo date('Y/m/d/H', strtotime("-1 day")). ""; //2005/04/03/18 echo date('Y/m/d/H', strtotime("last Sunday")). ""; //2005/04/02/23

RE: [PHP] strtotime time zone trouble

2005-01-18 Thread Michael Sims
Marcus Bointon wrote: > Much of the point of using zone names rather than fixed numeric > offsets is that it allows for correct daylight savings calculations > (assuming that locale data is correct on the server). > > Let me rephrase the question - how can I get the current time in a > named time z

Re: [PHP] strtotime time zone trouble

2005-01-18 Thread M. Sokolewicz
Tom wrote: Marcus Bointon wrote: On 18 Jan 2005, at 10:53, Tom wrote: PST = UTC - 8, therefore if you ask for strtotime in PST it will give you now + 8. This is standard in most languages, you are just reading the functionality back to front. ie when you say strtotome('now PST'), what you are as

Re: [PHP] strtotime time zone trouble

2005-01-18 Thread M. Sokolewicz
Marcus Bointon wrote: On 18 Jan 2005, at 10:53, Tom wrote: PST = UTC - 8, therefore if you ask for strtotime in PST it will give you now + 8. This is standard in most languages, you are just reading the functionality back to front. ie when you say strtotome('now PST'), what you are asking for is

Re: [PHP] strtotime time zone trouble

2005-01-18 Thread Tom
Marcus Bointon wrote: On 18 Jan 2005, at 10:53, Tom wrote: PST = UTC - 8, therefore if you ask for strtotime in PST it will give you now + 8. This is standard in most languages, you are just reading the functionality back to front. ie when you say strtotome('now PST'), what you are asking for is

Re: [PHP] strtotime time zone trouble

2005-01-18 Thread Marcus Bointon
On 18 Jan 2005, at 10:53, Tom wrote: PST = UTC - 8, therefore if you ask for strtotime in PST it will give you now + 8. This is standard in most languages, you are just reading the functionality back to front. ie when you say strtotome('now PST'), what you are asking for is the current local ti

Re: [PHP] strtotime time zone trouble

2005-01-18 Thread Tom
Marcus Bointon wrote: How is this not a bug? outputs: 2005-01-18 09:58:09 (correct) 2005-01-18 17:58:09 (incorrect) PST = UTC - 8, therefore if you ask for strtotime in PST it will give you now + 8. This is standard in most languages, you are just reading the functionality back to front. ie whe

[PHP] strtotime time zone trouble

2005-01-18 Thread Marcus Bointon
How is this not a bug? outputs: 2005-01-18 09:58:09 (correct) 2005-01-18 17:58:09 (incorrect) The time zone correction is applied in the wrong direction. Does it in both current PHP 4 and 5. Named time zones like these are supposedly deprecated, but the suggested alternative in the docs doesn't

Re: [PHP] Strtotime() weirdness

2004-06-02 Thread Burhan Khalid
Alex Hogan wrote: Does anybody know of any peculiarities in the strtotime() function? If I enter any date before 1 Jan 1970 I get a -1 returned. Note: The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that corr

Re: [PHP] Strtotime() weirdness

2004-06-01 Thread Daniel Clark
http://us3.php.net/manual/en/function.strtotime.php Note: The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer.) Additionally, not all plat

[PHP] Strtotime() weirdness

2004-06-01 Thread Alex Hogan
Does anybody know of any peculiarities in the strtotime() function? If I enter any date before 1 Jan 1970 I get a -1 returned. alex hogan * The contents of this e-mail and any files transmitted with i

Re: [PHP] strtotime Question

2004-01-27 Thread - Edwin -
Hi, On Tue, 27 Jan 2004 23:05:09 -0500 gohaku <[EMAIL PROTECTED]> wrote: > Hi everyone, > I made the mistake of using strtotime("day") instead of > strtotime("today") > to get the current time. > I was just curious, what is strtotime("day") represent? > > Below is what I used to test the "day"

[PHP] strtotime Question

2004-01-27 Thread gohaku
Hi everyone, I made the mistake of using strtotime("day") instead of strtotime("today") to get the current time. I was just curious, what is strtotime("day") represent? Below is what I used to test the "day" and "today" parameters: Testing One Minute Difference Thanks in advance. -Gohaku

Re: [PHP] strtotime bad logic or strtotime bug?

2003-11-17 Thread Gnik
WOW! Blindingly simple mistake --> couldn't see the forest before the trees (or something like that). THANKS for the helping hand! Gnik --- Eugene Lee <[EMAIL PROTECTED]> wrote: > On Fri, Nov 14, 2003 at 08:53:41PM -0800, Gnik wrote: > : > : One of my servers required a PHP upgrade. Afterwards o

Re: [PHP] strtotime bad logic or strtotime bug?

2003-11-16 Thread Eugene Lee
On Fri, Nov 14, 2003 at 08:53:41PM -0800, Gnik wrote: : : One of my servers required a PHP upgrade. Afterwards one of the PHP : projects stopped functioning. When it would run one section would : scroll endlessly. I can't figure out if it's a 'bug' or if it's bad : logic in the coding. Bad logic

Re: [PHP] strtotime bad logic or strtotime bug?

2003-11-15 Thread Chris Shiflett
--- Gnik <[EMAIL PROTECTED]> wrote: > I isolated the problem to be in the 'strtotime' function. Here is a > test I ran - when it runs, after getting to 2003-10-26, it scrolls > incessently: > > BEGIN CODE-- > $stop= "2003-12-27" ; > $start= "2003-01-01" ; > While ($start <> $stop) { >

[PHP] strtotime bad logic or strtotime bug?

2003-11-14 Thread Gnik
Greetings, One of my servers required a PHP upgrade. Afterwards one of the PHP projects stopped functioning. When it would run one section would scroll endlessly. I can't figure out if it's a 'bug' or if it's bad logic in the coding. I isolated the problem to be in the 'strtotime' function. Here

[PHP] strtotime() question

2003-09-14 Thread Kyle Bisignani
Hello, I'm not even quite sure if I am posting this message in the right place, so please bear with me. I have a question regarding the strtotime() function. I am developing a PHP script to handle dates for my web site, and I need an easy way to get from today to tomorrow to +2 days to +3 days

Re: [PHP] strtotime()

2003-08-14 Thread Chris Boget
> > strtotime( '+1 month', mktime( 0, 0, 0, 1, 1, 2003 )); > > I get back the timestamp for 1/31/2003 and not 2/1/2003. > Are you sure? Yeah, but I missed something in my above example. If I did this: strtotime( '+1 month GMT', mktime( 0, 0, 0, 1, 1, 2003 )); It came back with 1/31/2003 and no

  1   2   >