So I've been trying to format the output of my Umbraco.Date property. The date is extracted from a selection of content pages, and is to be posted on my frontpage alongside with other content from those content pages.
All of this is gathered in a PartialViewMacro.
Alias of my Umbraco.Date property:releaseDate
Format I need:dd-MM-yyyy
What I can get it to output:M/dd/yyyy hh:mm:ss a
I've tried using .ToString("dd-MM-yyyy"), but with no success.
I've tried adding <DateTime> at the end of my .GetPropertyValue
And I've tried with .getProperty("releaseDate").Value.ToString and others.
Format of Umbraco.Date property
Hey!
So I've been trying to format the output of my Umbraco.Date property. The date is extracted from a selection of content pages, and is to be posted on my frontpage alongside with other content from those content pages.
All of this is gathered in a PartialViewMacro.
Alias of my Umbraco.Date property:
releaseDate
Format I need:
dd-MM-yyyy
What I can get it to output:
M/dd/yyyy hh:mm:ss a
I've tried using
.ToString("dd-MM-yyyy")
, but with no success.I've tried adding
<DateTime>
at the end of my.GetPropertyValue
And I've tried with
.getProperty("releaseDate").Value.ToString
and others.None of them seem to work, in my case.
Current code:
Was hoping any of you could see what I've been doing wrong. Most likely something very silly I've missed, but I can't seem to find the problem.
Hope anyone's able to solve this for me.
Thanks in advance!
Hi Mikkel
One way of doing it is by using FormatDateTime method in the umbraco.library.
Your release date can the be formatted like this
So your above example would be
I hope this works for you :)
/Jan
This works perfectly, thanks a lot! :D
is working on a reply...