I have this date-time format coming from Twilio.

2019-03-28T11:09:49.000Z

I want to convert this into this and insert into MySQL.

2019-05-07 07:53:50

I have tried using DATE_FORMAT() but didn't get success.

Edit: This is what I have tried.

UPDATE table_name 
date = DATE_FORMAT('2019-03-28T11:09:49.000Z', '%m/%d/%Y %H:%i:%s %c/%e/%Y %T')
WHERE id = id;

1 Answers

0
braza On Best Solutions

You can convert the date you get to a unix timestamp using JavaScript/Node.js, then insert it into the database like so:

const date = new Date('2019-03-28T11:09:49.000Z');
const timestamp = date.getTime()

UPDATE table_name date = FROM_UNIXTIME(?) WHERE id = id;