Problem with formatting

2 posts, 0 answers
  1. David
    David avatar
    18 posts
    Member since:
    Dec 2010

    Posted 27 Dec 2010 Link to this post

    I would like to display the date in the following format : "dd/MM/yyyy hh:mm:ss" instead of the default "dd/MM/yyyy hh:mm", or in other words, I want to add seconds.
    I've tried the following :
    CultureInfo cultureInfo = new CultureInfo("es-ES");
    DateTimeFormatInfo dateInfo = new DateTimeFormatInfo();
    dateInfo.ShortDatePattern = "dd/MM/yyyy hh:mm:ss";
    cultureInfo.DateTimeFormat = dateInfo;
    RadDateTimePicker newTime = new RadDateTimePicker();
    newTime.Culture = cultureInfo;

    But I encounter a strange problem. I get the following format : "dd/MM/yyyy hh:mm:ss hh:mm".
    What am I doing wrong?

    Thank you

  2. Kaloyan
    Kaloyan avatar
    920 posts

    Posted 28 Dec 2010 Link to this post

    Hello David,

    Check the correct solution for your case down bellow:

    radDateTimePicker.Culture = new CultureInfo("es-ES")
                    DateTimeFormat = new DateTimeFormatInfo
                        ShortDatePattern = "dd/MM/yyyy",
                        ShortTimePattern = "hh:mm:ss"

    Best wishes,
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF
Back to Top