Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Brian McNally 18 posts 106 karma points
    Sep 20, 2013 @ 22:24
    Brian McNally
    0

    Formatting Date

    I am having a hard time just displaying the short month (JAN, FEB etc) for a date.

    I currently have:

    <div class="date">@Umbraco.Field("newsPublishDate", formatAsDate: true)</div>

    but can't find a way to display another format...any ideas where to look?

    Thanks

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Sep 20, 2013 @ 23:35
    Jeavon Leopold
    2

    Hi Brain,

    You can use a normal C# ToString formatting like this:

    <div class="date">@(Model.Content.GetPropertyValue<DateTime>("newsPublishDate").ToString("MMMM dd, yyyy"))</div>
    

    More info on options for formatting are available here

    Hope that helps you,

    Jeavon

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Sep 23, 2013 @ 11:30
    Jeavon Leopold
    0

    I just added a couple of missing parentheses above that are required due to the <DateTime>

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies