Search
Generic filters
Exact matches only
  • Update Date format in DB from Varchar to Date

    17th July 2013

    MySql

    mysql codehaven category

    Run the following in phpmyadmin sql area.

    ‘datatest’ is the tablename

    newdate = date format (2013-06-23)
    datetochange = varchar (23/06/2013)

    This should update all the old ways of storing the date to the new format, if you have stored it wrongly!
    (when testing this my data became (2030/07/22)!!!

    But the better way of doing is this: –

    Which worked
    newdate was the new field with date format
    date was the old varchar field

    Was this code snippet helpful?

    Comment on this Code Snippet?