Yes, you need to take your second variables in the if commands out of single quotes. Right now, it is checking if the current date == $datem2, rather than the results of $datem2. So, either remove the quotes altogether or use double quotes ("$datem2").
Basically, here's how single and double quotes work:
$value = "test"
echo '$value'; # will echo $value
echo $value; # will echo test
echo "$value"; # will echo test