Hi!
I'm using the ToShortDateString() macro method on a DateTime value returned from the database. This returns the standard format of mm/dd/yyyy, which is appropriate for my culture.
Our style guide requires the format to be mm.dd.yyyy (so periods instead of slashes).
Is there a way to do this with the default ToShortDateString() or do I need to build a custom one?
Ultimately, we actually want to end up with mm.dd in this instance, but in some cases throughout the site we will want the year.
Thanks!
-Eric
Hi Eric,
In K# you can use this code: {% String.FormatString("{0:MM.dd.yyyy}", DateTime.Now) |(identity)GlobalAdministrator%}
Or you could use <%# FormatDateTime(DateTime.Now, "MM/dd/yyyy HH:mm") %>
Either should get what you need.
Thanks, guys.
Anton, that's exactly what I was looking for.
Please, sign in to be able to submit a new answer.