P: n/a

I'm trying to compute the date 250 days ago and I get this
$now = getdate(strtotime("now"));
$old = getdate(strtotime("250 days"));
and I get right now with
$old["mon"] and $old["mday"]
31 june. Well, that doesn't sound right.
Can you spot the error?

I didn't know sci.bio.paleontology was that low traffic until I tried read
the thread "Where is everyone?" and found it to be expired.  
Share this Question
P: n/a

"Gunnar G" <de****@comhem.sewrote in message
news:sP*******************@newsb.telia.net...
I'm trying to compute the date 250 days ago and I get this
$now = getdate(strtotime("now"));
$old = getdate(strtotime("250 days"));
and I get right now with
$old["mon"] and $old["mday"]
31 june. Well, that doesn't sound right.
Can you spot the error?
Here's what I gets:
$now = Array
(
[seconds] =36
[minutes] =58
[hours] =12
[mday] =5
[wday] =1
[mon] =2
[year] =2007
[yday] =35
[weekday] =Monday
[month] =February
[0] =1170673116
)
$old = Array
(
[seconds] =36
[minutes] =58
[hours] =12
[mday] =31
[wday] =3
[mon] =5
[year] =2006
[yday] =150
[weekday] =Wednesday
[month] =May
[0] =1149069516
)
Now this is just a guess, but if 'june' comes from an array starting with
zero, so that 0=january, then 4=may and 5=june, it propably should start
from 1=january and in that case 5 would actually be may... If that doesn't
help, see the whole output of getdate with print_r() and post the result
here.

"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi"  lpk http://outolempi.net/ahdistus/  Satunnaisesti päivittyvä nettisarjis sp**@outolempi.net  rot13(xv***@bhgbyrzcv.arg)  
P: n/a

Now this is just a guess, but if 'june' comes from an array starting with
zero, so that 0=january, then 4=may and 5=june, it propably should start
from 1=january and in that case 5 would actually be may... If that doesn't
help, see the whole output of getdate with print_r() and post the result
here.
How can any one start counting from something else than zero in computer
applications?
Thanks! I'm so very, very stupid.

I didn't know sci.bio.paleontology was that low traffic until I tried read
the thread "Where is everyone?" and found it to be expired.  
P: n/a

"Gunnar G" <de****@comhem.sewrote in message
news:ag*******************@newsb.telia.net...
>Now this is just a guess, but if 'june' comes from an array starting with zero, so that 0=january, then 4=may and 5=june, it propably should start from 1=january and in that case 5 would actually be may... If that doesn't help, see the whole output of getdate with print_r() and post the result here.
How can any one start counting from something else than zero in computer
applications?
When dates are prsented in a numeric format, like YYYYMMDD, the months are
112, not 011 and this is what getdate outputs. No one said it's an array
offset, it's the ordinal number of the month. Calendars were invented before
computers. ;)
Thanks! I'm so very, very stupid.
I've been equally stupid once. That's how I knew what to suspect. Try
formatting dates with the php builtin function date() to avoid confusions
like that.

"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi"  lpk http://outolempi.net/ahdistus/  Satunnaisesti päivittyvä nettisarjis sp**@outolempi.net  rot13(xv***@bhgbyrzcv.arg)  
P: n/a

Gunnar G wrote:
>Now this is just a guess, but if 'june' comes from an array starting with zero, so that 0=january, then 4=may and 5=june, it propably should start from 1=january and in that case 5 would actually be may... If that doesn't help, see the whole output of getdate with print_r() and post the result here.
How can any one start counting from something else than zero in computer
applications?
Thanks! I'm so very, very stupid.
Actually, before C, most languages did start counting with 1....

==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================  
P: n/a

Gunnar G wrote:
$old = getdate(strtotime("250 days"));
and I get right now with
$old["mon"] and $old["mday"]
31 june. Well, that doesn't sound right.
I get $old["mon"] as "5"  that is, May, not June.
PHP numbers months starting with January as 1. This is different from
Perl's "time" and "gmtime" functions, which number months starting with
January as 0.

Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/CSS/Javascript/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!  
P: n/a

MessageID: <zG*****************@reader1.news.saunalahti.fifro m Kimmo
Laine contained the following:
>Thanks! I'm so very, very stupid.
I've been equally stupid once.
I'm regularly stupid. %}

Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/  
P: n/a

On Mon, 05 Feb 2007 11:09:58 GMT, Gunnar G wrote:
>Now this is just a guess, but if 'june' comes from an array starting with zero, so that 0=january, then 4=may and 5=june, it propably should start from 1=january and in that case 5 would actually be may... If that doesn't help, see the whole output of getdate with print_r() and post the result here.
How can any one start counting from something else than zero in computer
applications?
Standards are GREAT. And, you have so many to chose from!
Thanks! I'm so very, very stupid.
I don't think so. As someone who has worked his way through *A LOT* of
programming languages since 1966, "Counting from 0/1" is just _one_ of
the 'standards' I never take for granted. (And, I _still_ screw up....)
Jonesy

Marvin L Jones  jonz  W3DHJ  linux
38.24N 104.55W  @ config.com  Jonesy  OS/2
*** Killfiling google posts: <http://jonz.net/ng.htm>  
P: n/a

Allodoxaphobia wrote:
On Mon, 05 Feb 2007 11:09:58 GMT, Gunnar G wrote:
>>Now this is just a guess, but if 'june' comes from an array starting with zero, so that 0=january, then 4=may and 5=june, it propably should start from 1=january and in that case 5 would actually be may... If that doesn't help, see the whole output of getdate with print_r() and post the result here.
>How can any one start counting from something else than zero in computer applications?
Standards are GREAT. And, you have so many to chose from!
>Thanks! I'm so very, very stupid.
I don't think so. As someone who has worked his way through *A LOT* of
programming languages since 1966, "Counting from 0/1" is just _one_ of
the 'standards' I never take for granted. (And, I _still_ screw up....)
Jonesy
I seem to remember that back in the C64 days you could actually tell
the script (program) to start at 0 or 1 if you wanted. I can't remember
what that command was though...
Norm  
P: n/a

On Feb 6, 10:17 am, Norman Peelman <npeel...@cfl.rr.comwrote:
Allodoxaphobia wrote:
On Mon, 05 Feb 2007 11:09:58 GMT, Gunnar G wrote:
>Now this is just a guess, but if 'june' comes from an array starting with zero, so that 0=january, then 4=may and 5=june, it propably should start from 1=january and in that case 5 would actually be may... If that doesn't help, see the whole output of getdate with print_r() and post the result here.
How can any one start counting from something else than zero in computer
applications?
Standards are GREAT. And, you have so many to chose from!
Thanks! I'm so very, very stupid.
I don't think so. As someone who has worked his way through *A LOT* of
programming languages since 1966, "Counting from 0/1" is just _one_ of
the 'standards' I never take for granted. (And, I _still_ screw up....)
Jonesy
I seem to remember that back in the C64 days you could actually tell
the script (program) to start at 0 or 1 if you wanted. I can't remember
what that command was though...
Norm
VB6 allowed you to put the "Option Base 1" directive at the top of a
module to achieve the same result. Scary that I remember that...   This discussion thread is closed Replies have been disabled for this discussion.   Question stats  viewed: 1024
 replies: 9
 date asked: Feb 5 '07
