I have a timestamp string and a timezone, and I need to convert that into a Date object in UTC without using moment-timezone.
Essentially, I wanna be able to do this without external dependencies:
var date = moment.tz("2021-03-03 14:40:40", "Asia/Dhaka")
Is this possible? I'd rather not have to download a rather hefty package just for this.
Check it out
let dateString = new Date("2021-03-03 14:40:40").toDateString('en-US', {timeZone: 'Asia/Dhaka'}) console.log(dateString);
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.