Hi...
Can u tell me way where i can change the Date format of the control in XAML. I m following MVVM pattern. Is dere any inbuilt property by which we can directly change d date format...???
Plz reply ASAP.
Thanx n regards
Shehnaz Khan.
3 Answers, 1 is accepted
0
Yana
Telerik team
answered on 01 Jun 2011, 08:45 AM
Hello Shehnaz,
Please check this help article which explains how the date can be formatted in RadDateTimePicker. Unfortunately, you can define a custom format only in code-behind.
Regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
We have used cultute info to rad datepicker using the folloing code:
CultureInfo ldtPckrcultureInfo = new CultureInfo("en-US");
DateTimeFormatInfo dateInfo = new DateTimeFormatInfo();
dateInfo.ShortDatePattern = "MM-dd-yy";
ldtPckrcultureInfo.DateTimeFormat = dateInfo;
dtpStartDate.Culture = ldtPckrcultureInfo;
This was working fine.
But when we try to enter date manually into the date picker, the order of month, day and year gets changed.
On manually adding the date value in date picker, it takes the date in the different format (dd-yy-mm)
For example, if we enter 04-06-12 (6th April 2012), it becomes 12-06-04 (12th June 2004).
If we enter 04-15-12 (15th April 2012), we get error.
If we change an existing value, suppose, 01-11-12 to 01-10-12 , it becomes 10-12-01 .
0
Ivo
Telerik team
answered on 06 Jan 2012, 01:37 PM
Hi,
The DateTimeFormat.DateSeparator property is the key to resolving this issue. If you set it to "-" your code should work great. However I would recommend you not to create a new instance of DateTimeFormat class, because this will cause the RadDateTimePicker to be in invariant culture . Here is the recommended code for your scenario: