View Full Version : Changing Date Format In MySQL

03-13-2007, 04:43 AM
How can I change the way MySQL displasy the date format on my php page? At the moment it displays like YYYY/MM/DD and I want it to display DD/MM/YYYY... Any ideas?

03-13-2007, 04:48 AM
See the DATE_FORMAT() function at this link - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

03-13-2007, 04:57 AM
I'm sort of new at this, any chance you could be a little more specific, this is my table which displays the fileds from my table, the last 2 are what I want to show, but in the different formats...
<tr valign="top">
<td><?php echo $qry['ID']; ?></td>
<td><?php echo $qry['FirstName']; ?></td>
<td><?php echo $qry['LastName']; ?></td>
<td><?php echo $qry['State']; ?></td>
<td><?php echo $qry['JoinDate']; ?></td>
<td><?php echo $qry['loginDateTime']; ?></td>

03-13-2007, 05:02 AM
This is an example of how to use DATE_FORMAT:

SELECT *, DATE_FORMAT(`JoinDate`, '%m/%d/%y) as `JoinDate` WHERE ...