avatar
Convert an ISO Date to a Timestamp Javascript

> 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' }
24
get unix timestamp javascript convert timestamp to ISO date string
You need to login to do this manipulation!