We have a database with all the dates and times stored in one column called timestamp. The format of the date/time in the column "timestamp" is as: 03 Aug 08:10am.
I would like to convert this (03 Aug 08:10am) to UNIX TIMESTAMP in MySQL and not PHP because we already have over 500 rows with this format: 03 Aug 08:10am.
I tried create a new INT column called new_timestamp
and ran this query:
UPDATE table_name SET new_timestamp = UNIX_TIMESTAMP(timestamp);
However, it shows that 0 rows were affected.
This is not a duplicate, don't redirect me to how to convert in PHP. Read the question first :)
UPDATE table_name SET new_timestamp = UNIX_TIMESTAMP(STR_TO_DATE(CONCAT('2016-', timestamp), '%Y-%d %b %h:%i%p'));
– Mark Baker