SaaS CMS has officially launched! Learn more now.

DateTime format in edit mode



I have a question regarding date time format i EPi7 edit mode for ex: last published, modified, created and default EPi DateTime property (all located in Forms Editing mode). In EPi6 all these dates where in standard international date time format: yyyy-MM-dd HH:mm:ss regardless of user display language settings. In EPi7 all these dates are represented in date time format corresponding to the display language.

The issue now is that this creates a bit of confusion between our editors that use English and Swedish as display languages.

The question: Is there any way to configure date time format for a specific display language in EPi edit mode? I would like at least to make english language display dates like: yyyy-MM-dd HH:mm:ss


Jan 15, 2014 10:11

Hi, I also have the same problem, and unfortunately, the [DisplayFormat] attribute dont work.

But: If you use on-page editor properties, you can use displaytemplates as a workaround, ex.

On your pagetype:


public virtual DateTime MyDate {get; set;}

Then add a displaytemplate in ~/Views/Shared/DisplayTemplates/MyDateFormat.cshtml, like so:

@model DateTime
@Model.ToString("yyyy-MM-dd HH:mm:ss")


finally, in your page template (or wherever you are displaying the date property:

<div @Html.EditAttributes(m => m.MyDate)>@Html.DisplayFor(m => m.Mydate, "MyDateFormat")</div>


The reason you need the displaytemplate in /Shared, and not directly under ex. your page controllers view folder is that all properties rendered on the server side when you edit a value is rendered using the "PropertyRenderer" controller in EPiServer, this controller will not see any displaytemplates under other folders than the shared (or its own).

May 05, 2014 10:20
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.