i have date stored in database on date column in dd-mm-yyyy format. This column data type is VARCHAR. i wanted to convert those stored dates in yyy-mm-dd format. i tried using this MYSQL query:
UPDATE status SET new_time_creation = STR_TO_DATE(date, '%Y-%m-%d');
but this does not convert the dates properly (eg. 30-05-2016 => 2030-05-20). please help me with this query or suggest best on even using php to update the date format. Thanks!
varchar? There are predefined field types for date / time. Simply use them and format the output with PHP. php.net/manual/de/datetime.format.phptypeof the field.