This is a migrated thread and some comments may be shown as answers.

Problem with formatting

1 Answer 67 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 27 Dec 2010, 12:07 PM
Hi,
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

1 Answer, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 28 Dec 2010, 09:45 AM
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,
Kaloyan
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
Tags
DatePicker
Asked by
David
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Share this question
or