Skip to content
Advertisement

Convert Date to Day and Month (3 Letters)

I have date of each post stored in date field in db. The format is DD/MM/YYYY (eg : 24/12/2013). Field is VARCHAR(50)

I want to print Day and month in a page (A Blog listing page). ie like “24 DEC” (Doesnt need year)

What’s the best possible way to achieve it

Note : I’m using PHP

Advertisement

Answer

Please start storing dates in Y-m-d format in DATE fields. Your life, and ours, would be much easier.

Until then, use this php solution:

JavaScript

demo

or mysql solution:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement