date format like 'jan 2010'
Hi in my table i am saving the date as '2010-12-01' i,e but i want to convert the above 开发者_运维知识库date as 'Dec 2010'..can u please suggest me how to convert it?
thanks in advance
If you are using php then do the following:
echo date("M Y", strtotime("2010-12-01"));
Or in MySQL:
SELECT DATE_FORMAT('2011-01-12', '%M %Y')
Updated for "Jan 2011":
SELECT DATE_FORMAT('2011-01-12', '%b %Y')
Remember, if you want to use a different language for phps date function, you can use
setlocale (LC_TIME, "da_DK");to set it to danish (or any other language) instead of making a service function to parse this.
精彩评论