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
    Jun 2007
    Posts
    310
    Thanks
    86
    Thanked 3 Times in 3 Posts

    datetime problem?

    Hi Guys,

    I have a datetime column in mysql saved in the following format:

    2007-05-22 09:03:17

    How could I echo this information in a normal written date and time. I thought it would be something like:

    PHP Code:
    <?php $newdate strftime("%W %e %M %Y, %H:%i:%s"strtotime($row['published_web_date_time'])); ?>
    But that does not seem to work?

    Thanks

  • #2
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    I think your problem is because you're not using the US style of time, you see they generally have it mm/dd/yyyy where as you have it yyyy-mm-dd that is my guess.

  • #3
    New Coder
    Join Date
    Nov 2007
    Posts
    72
    Thanks
    0
    Thanked 1 Time in 1 Post
    For re-arranging information like that, I would recommend you look up explode. It's a handy function that will help you do what you need to do.

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,108
    Thanks
    2
    Thanked 326 Times in 318 Posts
    Here is the quickest and most efficient way of formatting a mysql DATETIME column in any format you want - http://dev.mysql.com/doc/refman/5.0/...on_date-format
    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.


  •  

    Posting Permissions

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