Search
Syndication
Sponsors

How Can I Convert A Mysql Timestamp Into A Format I Want Using Php?

I have a colum in a MySQL database that uses datatype TIMESTAMP to save the date and time that a new row is inserted. This displays like 2008-09-21 09:31:25 when retrieved and echoed using PHP.
How can I use PHP to display the data like 21-Sep-08?

Related posts:

  1. How To Use Php Code Stored In Mysql Database? I know how pull data from the database but I...
  2. How To Code A Simple Php Dynamic Dropdown Form Feild From Mysql? I been struggling with this all morning. I am tiring...
  3. display MySQL database rows alphabetically Learn more about display MySQL database rows alphabetically by visiting...
  4. Display rows from only a certain category of a MySQL database Learn more about Display rows from only a certain category...
  5. Show MySQL tables Learn more about Show MySQL tables by visiting our website....

Related posts brought to you by Yet Another Related Posts Plugin.

Tags: , , , , , ,

3 Responses to “How Can I Convert A Mysql Timestamp Into A Format I Want Using Php?”

  1. Jon R Says:

    print date(”d-M-y”, strtotime(’2008-09-21 09:31:25′))
    Will do the trick nicely!
    strtotime() will take just about any date format and give you a timestamp.

  2. Atif Majid Says:

    Try following piece of code
    < ?php
    $strTimeStamp = "2008-09-21 09:31:25";
    $arrTimeStamp = explode(" ", $strTimeStamp);
    $strDate = $arrTimeStamp[0];
    $arrDate = explode("-", $strDate);
    echo date("d-M-y", mktime(0,0,0,$arrDate[1], $arrDate[2], $arrDate[0]));
    ?>

  3. Fudge Says:

    use the Date() function , which takes two params : one being the timestamp and the other formatting string to specify how the date is presented.

Leave a Reply

Translate
Links

Tags