I'm working in SharePoint 2013, and I have created a custom display template for a Content Search Web Part. Three of my fields use dates, and all three are returning the dates in long format. I want to return the dates in short format but I just can't seem to get it to work.
I've tried the advice from these blog articles:
https://sharedpointtips.blogspot.com/2015/01/sharepoint-2013-display-template.html
https://sharepoint.protiviti.com/blog/Lists/Posts/Post.aspx?ID=132
http://sharepointfordeveloper.blogspot.com/2015/11/shareppoint-2013-ctx-variable-and-its_17.html
In the Header:
'Review Date'{Review Date Label}:'ReviewDateOWSDATE',
In the JavaScript section I have tried this:
var shortDate = Srch.U.toFormattedDate(dateresponsedue,'ShortDatePattern');
And this:
var shortDate2 = Srch.U.toFormattedDate(shortDate, 'ShortDatePattern');```
And this:
```var shortDate = Srch.U.toFormattedDate(ctx.CurrentItem.DateResponseDueforReviewOWSDATE, 'ShortDatePattern');```
This is my display code:
```<td rowspan="3" width="85px" style="text-align:center;"> _#= shortDate =#_ </td>'''
I need the date display to change from something like this:
2019-07-11T05:00:00Z;7/11/2019 5:00:00 AM
To something like this:
2019-07-11