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. #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. #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. #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    4,037
    Thanks
    3
    Thanked 492 Times in 480 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
    Finding out HOW to do something is called research, i.e. keep searching until you find the answer. After you attempt to do something and cannot solve a problem with it yourself, would be when you ask others for help.


 

Posting Permissions

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