JavaScript Date to UTC Format
new Date().toISOString()
> '2012-11-04T14:51:06.157Z'
VoiceTechGuy
new Date().toISOString()
> '2012-11-04T14:51:06.157Z'
var UTCdate = new Date('4/29/2021 3:22:46 PM UTC');
var onlyDate = UTCdate.getDate();
console.log(onlyDate); //Gives 29
//Please don't forget to upvote if this answer helped you ! Have a nice day !!
// construct a moment object with UTC-based input
var m = moment.utc(new Date('2015-01-01 00:00:00'));
// convert using the TZDB identifier for US Central time
m.tz('America/Chicago');
// format output however you desire
var s = m.format("YYYY-MM-DD HH:mm:ss");