Page 1 of 1

date() help

Posted: Sun Nov 13, 2005 4:22 pm
by will83
Hi

Can anyone tell me whats wrong with this statement:

Code: Select all

<?php
if (date("m") == "Nov") {
echo "selected";
}
?>
Thanks

Will

Posted: Sun Nov 13, 2005 4:40 pm
by ambivalent
date("m") returns the numeric month. Try:

Code: Select all

if (date("m") == 11) {
   //stuff 
}

Posted: Sun Nov 13, 2005 4:40 pm
by wtf
date("m") will return numric representation of the month. What you need to do is user date("M")

Posted: Sun Nov 13, 2005 4:43 pm
by will83
ahhhhhh :P

Cheers