0

Is there a way to convert this date input 01 Nov 2020, 9:55pm +10:00 to a timestamp like this 2020-11-01T11:55:00Z?

2 Answers2

0

you can use moment lib.

sample:

const moment = require("moment");

const inputDate = "01 Nov 2020, 9:55pm +10:00";
const formatedDate = moment(inputDate, "DD MMM YYYY, HH:mmA ZZ");
0

use new Date("01 Nov 2020, 9:55 pm +10:00").toISOString()

NOTE: make sure that 9:55 and PM are separated

const date = new Date("01 Nov 2020, 9:55 pm +10:00").toISOString()

console.log(date)
Marik Ishtar
  • 2,406
  • 1
  • 9
  • 22