PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Obadiah
Forum Regular
Posts: 580 Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:
Post
by Obadiah » Fri Oct 08, 2010 3:53 pm
Im trying to do a date comparison and I am not having any success...the statement returns false
Code: Select all
$time = time();
$MyMonth = "October";
$DMonth = date(F);
if ($MyMonth = $Dmonth){ //if ($MyMonth == $Dmonth) does not work either
echo "yes it matches up";
echo date("F" ,$time);
}
else
echo "no luck bro!";
echo date("F" ,$time);
can someone tell me what im doing wrong?
twinedev
Forum Regular
Posts: 984 Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio
Post
by twinedev » Fri Oct 08, 2010 4:06 pm
Well, there are several issues with the code you posted, but the first thing to check would be this line:
to be
Your line assigns $myMonth to be equal to $Dmonth, the second line actually does a comparison.
-Greg
Obadiah
Forum Regular
Posts: 580 Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:
Post
by Obadiah » Fri Oct 08, 2010 4:15 pm
as i posted in the previous code thats comented out..the (==) comparison didnt work either...but im open for more ideas!
twinedev
Forum Regular
Posts: 984 Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio
Post
by twinedev » Fri Oct 08, 2010 4:31 pm
ahh missed that (the code section doesn't show a horizonal scroll bar on here...)
Then the next to check would be that you are doing
instead of
See if that helps.
Obadiah
Forum Regular
Posts: 580 Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:
Post
by Obadiah » Fri Oct 08, 2010 4:37 pm
its working now...thanks bro!