I am experiencing a weird problem in creating date formats from date strings. An example date string in my code is October 21, 2006
. When I convert this to date using PHP date
and strtotime
function I always get current Year for year instead of the year originally present in date string.
Here it is:
$date=date("Y-m-d",strtotime('21 October,2006')); //Returns 2015-10-21 instead of 2006-10-21
What I am doing wrong?
Please note I always get the date string from user in this way i.e Day Full Month Name, Year
from the datepicker and I cannot change that.