To get the current date and time in UTC, you can use toUTCString() method. This method converts a date to a string using the UTC time zone.
A string representing the given date in the UTC time zone
let UTCstring = new Date().toUTCString(); console.log(UTCstring);
Wed, 12 Oct 2022 05:33:09 GMT
You can use getUTC methods that return date and time according to universal time.
let date = new Date(); console.log(date); console.log(date.getUTCDate()); console.log(date.getUTCMonth()); console.log(date.getUTCFullYear()); console.log(date.getUTCHours()); console.log(date.getUTCMinutes()); console.log(date.getUTCSeconds());
2022-10-12T05:56:18.351Z 12 9 2022 5 56 18