Copied to clipboard

Flag this post as spam?

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


  • Dibs 202 posts 991 karma points
    Apr 27, 2016 @ 13:57
    Dibs
    0

    updateDate field in us format

    Dear Umbraco Team

    how can you change the 'updateDate' field to render date and time in UK format instead of the default US format on a view ?

    Thanks Dibs

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    Apr 27, 2016 @ 14:07
    Dennis Adolfi
    100

    The format of the updateDate rendered is based on what language and culture you have set up for your site in Culture And Hostnames.

    So if i write this line of code:

    @CurrentPage.updateDate
    

    And set my site culture to English (United States) it will render:

    4/19/2016 1:05:43 PM
    

    But if i change the language for my site to English (United Kingdom) it will render:

    19/04/2016 13:05:43 
    

    Languages are set up in Settings, then right click on your home node and select the desired language. See image:

    enter image description here

    Best of luck to you!!

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    Apr 27, 2016 @ 14:10
    Dennis Adolfi
    0

    Or if you want you can just force the date to be en-GB in your view by:

    @using System.Globalization
     @CurrentPage.updateDate.ToString(new CultureInfo("en-GB"))
    
  • Dibs 202 posts 991 karma points
    Apr 27, 2016 @ 14:11
    Dibs
    1

    Cheers Dennis

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    Apr 27, 2016 @ 14:12
    Dennis Adolfi
    0

    Glad i could be of help! Have a great day!

  • 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