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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s no surprise:
strtotime(8)will give you0– 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
(the
1970is totally irrelevant – it could be any year.)Alternatively, maybe more beautifully, use
mktime()as shown by nikic.