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 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2003
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    change data time format

    when I retrieve my date and time from database and display as follow:

    2003-03-14 14:42:18

    How can I easily change the format into :

    Mar 14th, 2003, 2:42pm

  • #2
    New Coder
    Join Date
    Feb 2003
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    $date = date("F j, Y, g:i a", $retrieved_from_db);
    echo $date;

    You can check this page for more info on the date function and other formatting options :
    http://www.php.net/manual/en/function.date.php

    This will work only if the date stored in your db is stored as a unix timestamp which means you got it with the time() function.


  •  

    Posting Permissions

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