Answers for "javascript convert unix timestamp to UTC timestamp"

1

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;
}
Posted by: Guest on June-23-2021
0

convert date to unix timestamp javascript

new Date('2012.08.10').getTime() / 1000 //secs
new Date('2012.08.10').getTime() //milliseconds
Posted by: Guest on December-24-2020

Code answers related to "javascript convert unix timestamp to UTC timestamp"

Code answers related to "Javascript"

Browse Popular Code Answers by Language