Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm using MVC Razor.
I have my date picker field with:
@Model.Content.GetPropertyValue("date");
How do I now format it? I want dd-MM-yyyy.
I cant' make .ToString("dd-MM-yyyy") work.
Your help would be much appreciated.
Thanking you in anticipation.
Roger
Use the Umbraco Helper.
umbraco.library.FormatDateTime(Model.Content.GetPropertyValue("date").ToString(), "dd-MM-yyyy")
https://our.umbraco.org/wiki/reference/umbracolibrary/formatdatetime/
Value Converter approach if you prefer to use built-in .net helpers.
DateTime date = Model.Content.GetPropertyValue<DateTime>("date");
and in your view
<p>Date: @date.ToString("dd-MM-yyyy")</p>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Format date picker property
I'm using MVC Razor.
I have my date picker field with:
@Model.Content.GetPropertyValue("date");
How do I now format it? I want dd-MM-yyyy.
I cant' make .ToString("dd-MM-yyyy") work.
Your help would be much appreciated.
Thanking you in anticipation.
Roger
Use the Umbraco Helper.
https://our.umbraco.org/wiki/reference/umbracolibrary/formatdatetime/
Value Converter approach if you prefer to use built-in .net helpers.
and in your view
is working on a reply...