Copied to clipboard

Flag this post as spam?

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


  • Kristina 33 posts 49 karma points
    Apr 08, 2013 @ 12:35
    Kristina
    0

    Format Date (date picker with time)

    Hello!

    I use a datatype date picker with time to show a date and the time of a match. It is shown like that : 2013-03-24T15:00:00

    How can I format it? 

    foreach(var mannschaft in Model.Descendants()){
    @mannschaft.GetProperty("title_" + Session["Lang"].ToString().ToLower())
    @foreach(var spiel in mannschaft.Descendants()){

    @spiel.GetProperty("datum").ToString("dd/MM/yyyy - H:mm")

    } }

    I tried like that with 'ToString' but it doesn't work :(

    I want to show the date like this: 24/03/2013 - 15:00

  • gary 385 posts 916 karma points
    Apr 08, 2013 @ 12:45
    gary
    0

    Hi

    @spiel.GetProperty("datum").ToString("f")

    should return as you ask

    Regards

    G

  • Kristina 33 posts 49 karma points
    Apr 08, 2013 @ 13:27
    Kristina
    0

    Thank you for the quick reply, I tried it and I got back an error:

    Error loading Razor Script 'Meisterschaft_GetMannschaften.cshtml'
    No overload for method 'ToString' takes '1' arguments

  • stevo 63 posts 106 karma points
    Apr 08, 2013 @ 13:38
    stevo
    0

    try: @spiel.GetValue<DateTime>("datum").ToString("dd/MM/yyyy - H:mm")

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Apr 08, 2013 @ 14:06
    Fuji Kusaka
    1

    Try

    @spiel.datum.ToString("dd / MMM / yyyy - H:mm") 
  • Kristina 33 posts 49 karma points
    Apr 08, 2013 @ 14:40
    Kristina
    0

    Thank you Fuji, it works ! :)

     

Please Sign in or register to post replies

Write your reply to:

Draft