I have dates in my database in this format yyyy-dd-mm (datatype date). How can I display these dates for example as 4 May, 2011? Using the following didn’t work as it interprets the date as a time and I don’t want to use a time:
Thanks guys, all solutions presented here work and I chose Mike’s manual approach because it allows me to format the date exactly how I wanted as described here: http://www.php.net/manual/en/function.date.php .
Note that CDateFormatter has the advantage that it automatically uses the right format for each country/locale (i18n). If you don’t need that, then date() is more apropriate and maybe simpler to use.