Results 1 to 2 of 2

Thread: MySQL Timestamp into PHP Format

  1. #1
    Join Date
    Dec 2007
    Posts
    123
    Thanks
    17
    Thanked 1 Time in 1 Post

    Question MySQL Timestamp into PHP Format

    I have a timestamp column in a mysql table.

    Using PHP, how do I convert the timestamp format which is "YYYY-MM-DD HH:MM:SS" into a format like "March 16 2008, 08:41 am" ?


    Please help



    Thanx

  2. #2
    Join Date
    Mar 2008
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by cancer10 View Post
    I have a timestamp column in a mysql table.

    Using PHP, how do I convert the timestamp format which is "YYYY-MM-DD HH:MM:SS" into a format like "March 16 2008, 08:41 am" ?

    Please help
    Thanx
    try something like this:
    Code:
    $showdate = date('M d Y, H:i a', strtotime($row['orderdate']));
    change orderdate to the fieldname in your table, and just the echo $showdate..

    check out http://uk3.php.net/date for the different formatting

Bookmarks

Posting Permissions

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