Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    459
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Changing Date Format In MySQL

    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?

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,146
    Thanks
    2
    Thanked 333 Times in 325 Posts
    See the DATE_FORMAT() function at this link - http://dev.mysql.com/doc/refman/5.0/...functions.html
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    459
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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...
    Code:
    ?>
      <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>
      </tr>
    <?php

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    This is an example of how to use DATE_FORMAT:
    Code:
    SELECT *, DATE_FORMAT(`JoinDate`, '%m/%d/%y) as `JoinDate` WHERE ...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •