Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript date to utc format

new Date().toISOString()
> '2012-11-04T14:51:06.157Z'
Comment

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;
}
Comment

convert js date to utc

var UTCdate = new Date('4/29/2021 3:22:46 PM UTC');
console.log(UTCdate)
 // console.log(new Date('2020-1-1'+'UTC'));
// output 
// Thu Apr 29 2021 21:07:46 GMT+0545 (Nepal Time)
Comment

PREVIOUS NEXT
Code Example
Javascript :: typeof in js 
Javascript :: vue font awesome icons 
Javascript :: one component to another component in vuejs trigger function 
Javascript :: js format indian price with commas 
Javascript :: js start at this character 
Javascript :: react redux thunk 
Javascript :: css react 
Javascript :: async storage react native 
Javascript :: mongoose encrypt password 
Javascript :: vscode add shortcut to run in terminal 
Javascript :: javascript change _ to space 
Javascript :: vue 3 install eslint 
Javascript :: firebase functions add to database 
Javascript :: manage nodejs versions on windows 
Javascript :: use moment js in ejs file 
Javascript :: js jwt decode 
Javascript :: concat multiple arrays in javascript 
Javascript :: get channel object using its name discod.js 
Javascript :: find items in array not in another array javascript 
Javascript :: deleteicon material ui improt 
Javascript :: express route parameters 
Javascript :: node-red Logging events to debug 
Javascript :: how to load js in vuejs components 
Javascript :: how to copy a javascript array 
Javascript :: import javascript 
Javascript :: discord.js if arguments null 
Javascript :: js push object in array 
Javascript :: Sign in with Apple JS 
Javascript :: express controller 
Javascript :: web3 connect to smart contract 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =