Friday, July 24, 2020

JavaScript : How to Convert UTC Date Time to local/EST Hours using JavaScript?

In this below script, Convert UTC Date Time to local/EST Hours

Convert UTC Date Time to local/EST Hours In SharePoint
In this article , we will use default java-script action

Type 1:

var localTime = new Date();
var localKolkata = moment.tz(localTime, "Asia/Kolkata").format("hh:mm:ss");

Javascript script provide date and time format.

Type 2:

function getLocalTime(i) {
    if (typeof i !== 'number') return;
    var d = new Date();
    var len = d.getTime();
    var offset = d.getTimezoneOffset() * 60000;
    var utcTime = len + offset;
    return new Date(utcTime + 3600000 * i);
}

#sharepoint #javascript #datetime #jquery #convertdatetime

1 comment: