> Convert an ISO Date to a Timestamp using JavaScript
exports.handler = async (event, context) => {
var isoString = '2022-12-17T16:11:24.798Z';
var timestamp = new Date(isoString).getTime();
const response = {
statusCode: 200,
body: JSON.stringify(timestamp),
};
return response;
};
> Output
node -r esbuild-register run.ts
{ statusCode: 200, body: '1671293484798' }