Copied to clipboard

Flag this post as spam?

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


  • Doogie Talons 183 posts 318 karma points
    Apr 26, 2019 @ 14:29
    Doogie Talons
    0

    Having trouble rendering a date in umbraco 8

    Nothing seems to work

    @item.Value("articleDate").ToString("dd MM yyyy")
    
    @item.Value<DateTime>("articleDate").ToString("dd MM yyyy")
    

    What am I missing ?

    Kind Regards

    Rob

  • Rhys Hamilton 140 posts 942 karma points
    Apr 26, 2019 @ 15:02
    Rhys Hamilton
    100

    You could try sticking the value in a variable like so:

    var articleDate = item.Value<DateTime>("articleDate").ToString("dd MM yyyy");
    
    <p>@articleDate</p>
    
  • Doogie Talons 183 posts 318 karma points
    Apr 26, 2019 @ 15:08
    Doogie Talons
    1

    Super, that works.

    Cheers :)

  • George Phillipson 108 posts 287 karma points
    Apr 26, 2019 @ 22:46
    George Phillipson
    0

    Hi Doogie Talons

    Just tested with my version of Umbraco and works OK.

    Please see image attached

    enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft