Thursday 18 March 2021

Changing date format using JavaScript

String.format is defined in msajaxbundle.js, loaded even before most of the JavaScript files so safe to use without SOD requirements or anything.

SharePoint adds a String.format function

so you can use:


String.format('{0:yyyy}-{0:MM}-{0:dd}',new Date('2015-10-30T05:00:00Z'));

No comments:

Post a Comment