This project is read-only.

Formatting date returned in an HTMLEditor

Jun 3, 2015 at 2:24 PM
Hi,

I have a date I'm pulling from SQL. In SQL it is in the format dd-mm-YYYY, so on my index return I have the following column properties:
         columns.Add(model => model.DOB).Titled("DOB").Format("{0:dd/MM/yyyy}").SetWidth(110).Sortable(true);
I tried appending the same property to the edit page in this section:
         <dt>
            @Html.DisplayNameFor(model => model.DOB)
        </dt>

        <dd>
            @Html.EditorFor(model => model.DOB)
            @Html.ValidationMessageFor(model => model.DOB)
        </dd>

But obviously got a compilation error. What's the easiest way to get this looking how I want it to. At the moment in the editor it appears like this:
         DOB: {04/04/1904 00:00:00}
Jun 10, 2015 at 10:54 AM
For info, I ended up using this:
    <dd>
            @Html.TextBoxFor(model => model.DOB, "{0:dd-MM-yyyy}")
            @Html.ValidationMessageFor(model => model.DOB)
        </dd>