How to get year and month from a given date.
e.g. $dateValue = \'2012-01-05\';
$dateValue = \'2012-01-05\';
From this date I need to get year as 2012
You can use this code:
$dateValue = strtotime('2012-06-05'); $year = date('Y',$dateValue); $monthName = date('F',$dateValue); $monthNo = date('m',$dateValue); printf("m=[%s], m=[%d], y=[%s]\n", $monthName, $monthNo, $year);