Sounds trivial but seems to be harder than I thought: I want to set a date field in a SharePoint Online (should be compatible with 2016) form via JavaScript/JQuery:


Works well, as long as the language is english. But other formats won't work. Is there a way to get the date format with JS or make SharePoint to accept the english format?

Actually SharePoint recognizes the date correctly, if you set the field with JQuery (no matter which format) and then click the date picker, it shows the correct date. But of course it should be possible to save the form without that. Maybe there is a way to trigger that artificially...


1 Answer 1


SharePoint in general will accept dates in multiple formats, with yyyy/mm/dd being the most universal and safest. Formats like yyyy/mm/dd work consistently with REST APIs for example. The problem is with JavaScript added to SharePoint's forms and dates is that the page's built-in validation is expecting a single culture's format.

In your JavaScript try adjusting the date using ".toLocaleSting()" with or without parameters.


See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString

  • Doesn't toLocaleString() returns just the browser setting? I need the SharePoint-Setting. I know that you can set everything via REST, but I'm using a normal list form and the JS validation of SharePoint doesn't like English strings if the Region setting is German if I save the item. Is it possible to get the time format via REST???
    – Dave
    Mar 19, 2018 at 20:17

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.