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
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
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 !!
convert timestamp to utc javascript
function utcformat(d){
d= new Date(d);
var tail= 'GMT', D= [d.getUTCFullYear(), d.getUTCMonth()+1, d.getUTCDate()],
T= [d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds()];
if(+T[0]> 12){
T[0]-= 12;
tail= ' pm '+tail;
}
else tail= ' am '+tail;
var i= 3;
while(i){
--i;
if(D[i]<10) D[i]= '0'+D[i];
if(T[i]<10) T[i]= '0'+T[i];
}
return D.join('/')+' '+T.join(':')+ tail;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us