Change MySQL date output in PHP page
Posted 16 March 2006 - 11:19 PM
One of them is a date and it comes back in the format 2006-03-17, but I want it to display to the screen in the format 17 March. Is this possible?
Posted 17 March 2006 - 12:53 AM
<?php $date = "2001-01-05"; echo date('M d, Y', strtotime($date)); ?>
I don't know what your variable name is that gets the date from your database, so just replace $date in the echo line with your date variable name and change the echo to whatever it is you need to do with it.
I can't stop you from doing something silly, but at least I can help you do it right.
Posted 17 March 2006 - 01:09 AM
[a href=\"http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.0/en/dat...-functions.html[/a]
SELECT DATE_FORMAT(lastDate, '%M %D') AS formatted_date
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users