Jump to content

PHP Date


jandrews3

Recommended Posts

I'm just missing something stupid, I know I am, but I've been working on it for more than an hour.

Why does the following code:

$month = 3;
$day = 9;
print "M: ".$month."<br>";
print "D: ".$day."<br>";
$due = $month." / ".$day;
print $due."<br>";
print date("M j", $due)."<br>";

 

yield the following output:

M: 3

D: 9

3 / 9

Dec 31

 

AUGGHHH! Shouldn't the last line be "Mar 9"???? I know. I'm stupid but my brain fried after I accidentally deleted my quiz table with nearly 90 quizzes for my students ... and NO, I was too stupid to have backed it up. So ... I'm not all here right now. But I just can't figure what's going wrong with this script. Thanks!

Link to comment
https://forums.phpfreaks.com/topic/266098-php-date/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.