I have the following date in UTC format:
2016-06-18T05:18:27.935Z
I am using the code below to convert it to the following format 2016-06-18 05:18:27
so I can compared it in MySQL
database against updatedAt
column.
var date = new Date(lastRequest);
date = date.getUTCFullYear() + '-' +
('00' + (date.getUTCMonth() + 1)).slice(-2) + '-' +
('00' + date.getUTCDate()).slice(-2) + ' ' +
('00' + date.getUTCHours()).slice(-2) + ':' +
('00' + date.getUTCMinutes()).slice(-2) + ':' +
('00' + date.getUTCSeconds()).slice(-2);
I need to get the date of the last record and convert its date back to UTC format.
Basically, how do I go from the following format: 2016-06-18 05:18:27
back to UTC?