I am using the following code in php to convert the month in numeric to textural representation.
date('M',strtotime(8));
But for every digit I am getting 'Dec' as my month.
How should i make it work.
Thank you Zeeshan
I am using the following code in php to convert the month in numeric to textural representation.
date('M',strtotime(8));
But for every digit I am getting 'Dec' as my month.
How should i make it work.
Thank you Zeeshan
But for every digit I am getting 'Dec' as my month.
That's no surprise: strtotime(8) will give you 0 - and that is January 1st, 1970, 0:00:00 UTC, in your local time zone (where it was still december at that point).
You could use
$month = 8;
date("M", strtotime("1970-$month-01"));
(the 1970 is totally irrelevant - it could be any year.)
Alternatively, maybe more beautifully, use mktime() as shown by nikic.