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

RadDatePicker DateFormat is not showing a 4 digit year

3 Answers 79 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Parker
Top achievements
Rank 1
Parker asked on 22 Oct 2014, 06:43 PM
I've try to set the DisplayFormat property to Short.  I've also tried to explicitly set the  format using StringFormat on the SelectedDate property.

No matter what I do I can only get the mac to display a 2 digit year (the browser is Safari).  It works fine on windows.


How can I make the selected date display in the format of MM/dd/yyyy?

3 Answers, 1 is accepted

Sort by
0
Parker
Top achievements
Rank 1
answered on 22 Oct 2014, 07:18 PM
I'm not sure my first post was completely clear.  

The issue that I'm having is with an Apple MacBook Air.  I've seen it on another Mac too.

The Macs display the year in a 2 digit format and I can't get them to display a 4 digit year.
0
Georgi
Telerik team
answered on 23 Oct 2014, 02:05 PM
Hi Parker,

Setting DisplayFormat  to short will mean that the DateTimePicker will use the sort format of the current culture on the machine (if not otherwise set). So on Mac the default culture is with only two digits and on Windows is with 4 and that is why the difference can be observed in the DateTimePicker.

Nevertheless if you want to set the year to always 4 digits you can do so by setting the Culture property of the DateTimePicker:

CultureInfo cultureInfo = new CultureInfo("en-us");
DateTimeFormatInfo dateInfo = new DateTimeFormatInfo();
dateInfo.ShortDatePattern = "MM/dd/yyyy";
cultureInfo.DateTimeFormat = dateInfo;
 
dateTimePicker.Culture = cultureInfo;

Hope this would help.

Regards,
Georgi
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Parker
Top achievements
Rank 1
answered on 24 Oct 2014, 03:39 PM
That worked, thanks.
Tags
DatePicker
Asked by
Parker
Top achievements
Rank 1
Answers by
Parker
Top achievements
Rank 1
Georgi
Telerik team
Share this question
or