convert time into utc javascript code example
Example 1: javascript get utc time
const now = new Date()
// UTC Date String
now.toUTCString() // "Sun, 30 May 2021 14:59:15 GMT"
// ISO String
now.toISOString() // "2021-05-30T14:59:15.449Z"
// Unix timestamp
Math.floor(now / 1000) // 1622386878
Example 2: convert utc to date javascript
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 !!