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

RadCalendar localize date

3 Answers 79 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 08 Dec 2010, 08:32 PM
The rad calendar seems to localize everything but the date itself. For French locale, the date should be DD/MM/YYYY.

This is the code that localizes everything but the date on the RadCalendar:

rcCurrent.CultureInfo =

 

new System.Globalization.CultureInfo(UserContext.Locale);

What am I missing to get the date to localize?

 

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Dec 2010, 08:15 AM
Hello Greg,

I guess your problem is regarding the format of the selected date.One method to get the date in required format is to set the DateTimeFormat of CurrentCulture form code behind. Here is the code that i tried.

C#:
protected void Page_Load(object sender, EventArgs e)
   {
    RadCalendar1.CultureInfo = new System.Globalization.CultureInfo("fr-FR", true);
    CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name);
    ci.DateTimeFormat.ShortDatePattern= "dd/mm/yyyy";
    Thread.CurrentThread.CurrentCulture = ci;
   }

protected void RadCalendar1_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e)
   {
 
       DateTime date = RadCalendar1.SelectedDate;//Date in DD/MM/YYYY format
   }

Thanks,
Princy.
0
Greg
Top achievements
Rank 1
answered on 17 Dec 2010, 10:43 PM
The problem with that is the date will always be in DD/MM/YYYY format, even if my locale is United States. I need the date formate to change based on locale, not based on a hard-coded format. It seems everything else in the radcalendar other than the date format localizes properly based on locale.
0
Greg
Top achievements
Rank 1
answered on 20 Dec 2010, 08:23 PM
You were right, this has been resolved. Thanks!
Tags
Calendar
Asked by
Greg
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Greg
Top achievements
Rank 1
Share this question
or