Skip links

How to reformat the date from a MYSQL database with php

September 18, 2010

To display a date retrieved from a recordset in a new format (In this case from a recordset ‘rs_news’):

  • <?php echo date(‘d M Y’, strtotime($row_rs_news[‘date’])); ?>

When inserting the date in your MySQL database from an update form it needs to be in the MySQL format yyyy-mm-dd. To update a record in this format use;

  • GetSQLValueString(date(‘Y-m-d’, strtotime($_POST[‘date’])), “date”));
chris-parker
This website uses cookies to improve your web experience.
chris-parker

Send me a message.

Happy to answer any question you may have.

chris@chrisparkerdesign.co.uk

07813 311253

    Your Name (required)

    Your Email (required)

    Subject

    Your Message

    CHRIS PARKER DESIGN

    chris@chrisparkerdesign.co.uk

    07813 311253