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 13 posts 91 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 3072 posts 13628 karma points MVP 10x 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 3072 posts 13628 karma points MVP 10x 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>

Please Sign in or register to post replies

Write your reply to:

Draft