April 2, 2012
Match 2 dates in php
Question by user1307519
I need to match a date from database which is in format e.g 2012-04-12 with month e.g January using php can any one please help
It`s ok if there is any alternate answer
Pl help……..
Answer by Starx
Quite a horrible question, but I will guess the problem.
To retrieve the month from the database
$date = $row['date']; //example of retrieving data row
$month = date("M",strtotime($date)); // retrieving the month of the date
//Now match them
if($month == "January") {
//do something
}