Gravatar for gagarwal@rightpoint.com

Question by Gaurav Agarwal, Mar 8, 2017 5:36 AM

Change Epoch into System date

Hi All,

I am using coveo code to retrieve sitecore Date field and I am getting value in Epoch format. Like I am using below code to retrieve the date -

<span class="event__date">{{=(raw.@(Model.ToCoveoFieldName(Stout.Website.Domain.Constants.Fields.StartDate, false))) }}</span>

I am getting 1489622400000 value but I want it simple date format, how can I achieve that in my code.

1 Reply
Gravatar for flguillemette@coveo.com

Answer by François Lachance-Guillemette, Mar 8, 2017 7:40 AM

coveo-search-ui provides the date() Result Template Helpers which you can use in your result templates.

So your code would look like:

{{= date(raw.@(Model.ToCoveoFieldName(Stout.Website.Domain.Constants.Fields.StartDate, false))) }}
Ask a question