I'm trying to format an string date that looks like this:
Tue Mar 13 2018 00:00:00 GMT-0600 (Mountain Daylight Time)}
to:
"2018-03-13T00:00:00",
Can anyone tell me what I'm missing or need to add? Thanks a lot in advance!
let someDate = 'Tue Mar 13 2018 00:00:00 GMT-0600 (Mountain Daylight Time)}'; console.log(someDate.replace(/T.+$/, "T00:00:00"));
let someDate = 'Tue Mar 13 2018 00:00:00 GMT-0600 (Mountain Daylight Time)'; console.log(new Date(someDate).toISOString().replace(/T.+$/, "T00:00:00"));
someDate.toISOString()将为您提供ISO格式的日期
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.