Format SharePoint dates fetched with Client object model using Moment.js
Date time fields in SharePoint are by default in UTC (Coordinated Universal Time) format.
So when fetching list items using SharePoint client object model the date-time value they contain will be returned in a UTC format that by default looks like this –
Fri Jun 13 13:00:00 UTC+0300 2014
So in order to format your date download the latest version from their web and reference it in your code –
After fetching your items format your date value by using the next line of code –
MyDate = moment.utc(MyDate).format(‘d MMMM YYYY’);
You can use any type of format you need or manipulate your date, check out the Moment.js documentation
for more information about what you can do.
Finally Here’s a full code example of fetching list items using SCOM and formatting their date value –