By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,748 Members | 1,427 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,748 IT Pros & Developers. It's quick & easy.

Strange Dec 1969 Bug with date

P: n/a
The following piece of code should iterate through the months printing
out the months and years combined. However date seems to have a
preference for December 1969 after February 2004 (which of course, we
all know, should be March 2004). After it prints 1969 it will happily
print April 2004 as though nothing happened:

$td = date("j");
$tm = date("MY");
# MonthsYears
for ( $i = 0; $i <=6 ;$i ++){
$theday = mktime(0,0,0,date("m")+$i ,date("d") ,date("Y"));
$option =date("M y", $theday ); // Set how it will look.
echo "$option<br>";

}

this will print out
Oct 03
Nov 03
Dec 03
Jan 04
Feb 04
Dec 69
Apr 04

which errr isnt right.

Any ideas gratfully recevied. This cant be the first time!
PHP Version 4.3.3
will
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

On 28-Oct-2003, sp**@sourceymonkey.com (will) wrote:
The following piece of code should iterate through the months printing
out the months and years combined. However date seems to have a
preference for December 1969 after February 2004 (which of course, we
all know, should be March 2004). After it prints 1969 it will happily
print April 2004 as though nothing happened:

$td = date("j");
$tm = date("MY");
# MonthsYears
for ( $i = 0; $i <=6 ;$i ++){
$theday = mktime(0,0,0,date("m")+$i ,date("d") ,date("Y"));
$option =date("M y", $theday ); // Set how it will look.
echo "$option<br>";

}

this will print out
Oct 03
Nov 03
Dec 03
Jan 04
Feb 04
Dec 69
Apr 04

which errr isnt right.

Any ideas gratfully recevied. This cant be the first time!
PHP Version 4.3.3


The code you posted works fine for me (e.g. it displayed Mar 04).

Why don't you echo the values of $theday and $i to see which is getting
screwed up?

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #2

P: n/a
"Tom Thackrey" <us***********@nospam.com> wrote in message news:<vW*************@newssvr14.news.prodigy.com>. ..
On 28-Oct-2003, sp**@sourceymonkey.com (will) wrote:
The following piece of code should iterate through the months printing
out the months and years combined. However date seems to have a
preference for December 1969 after February 2004 (which of course, we
all know, should be March 2004). After it prints 1969 it will happily
print April 2004 as though nothing happened:

$td = date("j");
$tm = date("MY");
# MonthsYears
for ( $i = 0; $i <=6 ;$i ++){
$theday = mktime(0,0,0,date("m")+$i ,date("d") ,date("Y"));
$option =date("M y", $theday ); // Set how it will look.
echo "$option<br>";

}

this will print out
Oct 03
Nov 03
Dec 03
Jan 04
Feb 04
Dec 69
Apr 04

which errr isnt right.

Any ideas gratfully recevied. This cant be the first time!
PHP Version 4.3.3


The code you posted works fine for me (e.g. it displayed Mar 04).

Why don't you echo the values of $theday and $i to see which is getting
screwed up?


Nope I think its a Mac Bug. Hell knows why.. works fine on linux and
windows php builds
Ive fixed it by a bodge for now.

:(

w
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.