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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.