Stop SharePoint converting dates to GMT timezone

I often used with SharePoint custom forms and in general I based my development on SharePoint JSOM. Working with it, I am often requested to update date and time fields using JSOM. But there is a small issue with it.

var dt = new Date();

The code above is with working, with an exception. It converts the date to GMT timezone. If my timezone is GMT + 2, recorded date will have 2 hours less then I have specified. The workaround is to convert the date into formatted string.

var dt = new Date();

Date format function is provided by MicrosoftAjax, which is included by default.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s