$month_name = 'Feb'; $month_number = date("m", strtotime($month_name));
From above code, I get the output is 03 not 02. Why?
I suppose it's caused by current date and default value of date in
strtotime function. Today we have 31 December so if you use strtotime, default value of date will be 31 Dec 2015, but if you change month to Feb the date will be 03 Mar 2015. Solution here is to add first day number at the begining e.g.
$month_name = '1 Feb'; $month_number = date("m", strtotime($month_name));