Use toISOString() to convert Date Time to UTC or GMT in Javascript.
Sample code:
let currentDateTime = new Date();
console.log(
'currentDateTime is ' +
currentDateTime
);
console.log(
'currentDateTime in UTC is ' +
currentDateTime.toISOString()
);
Output: