The timezone set in SharePoint Online is EST and when it is being saved to SharePoint using CSOM/ECMA script from location with UTC +5:30 timezone the date is reduced. Everytime we edit the time is reduced. What is the right way to save date to SP using CSOM? SharePoint OOTB save it as per the local timezone

4 Answers 4


You can use the JavaScript methods like getUSTDate(), getUSTHour(), getUSTMinute(), getUSTMinute() to Get the Current UST date and Time. Please refer the Link

Or you have to convert it manually using the below code

function convertToServerTimeZone(){
    offset = -5.0
    clientDate = new Date();
    utc = clientDate.getTime() + (clientDate.getTimezoneOffset() * 60000);
    serverDate = new Date(utc + (3600000*offset));
    alert (serverDate.toLocaleString());

You can use the SP.RegionalSettings.timeZone property from sp.js to get the server timezone. The LCID for the current context can be gotten directly from 2 variables:

//as an int
var lcid =_spPageContextInfo.currentLanguage; 
// or as a string
var lcid = SP.Res.lcid; 

I don't have privileges to comment so adding it as an answer. SharePoint stores the dates internally as UTC, so when you add any data you need to manually convert the time to UTC otherwise when added from a different time zone you'll always see a time difference.


You can try out SP.TimeZone.localTimeToUTC which actually converts your date-time as per the UTC DateTime.

var isoDate = SP.TimeZone.localTimeToUTC(yourdatefield).toString();

Refer How to: Set a date with correct time in a SharePoint list item

All the best!!

Sharing is caring....


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.