We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How can I change the format of the date display header item in the scheduler week view to the format I want?

How can I change the format of the date display header item in the scheduler week view to the format I want?
No customization of date display header items in weekly view;

"SchedulerControl.Appearance.WeekMonthFullFormat" property.
"MMM d, yy" to "yyyy-mm-dd"
We need an example that converts "MMM d, yy" to "yyyy-mm-dd" for localizing("ko-KR") One more.
We need an example that converts date format 'mm, yyyy' to 'yyyy-mm' in SchedulerControl calendar navigator; Thank you.

3 Replies

JP Jagadeesan Pichaimuthu Syncfusion Team June 19, 2019 12:13 PM UTC

Hi Smart, 
  
Thanks for contacting Syncfusion support. 
  
Query 
Response 
How can I change the format of the date display header item in the scheduler week view to the format I want?
No customization of date display header items in weekly view;
 
We suspect that you are using Metro theme appearance for Schedule control. If yes means, you could implement the following code to achieve your reported scenario. Please refer the following code example and the sample. 
  
C# 
scheduleControl1.Appearance.VisualStyle = Syncfusion.Windows.Forms.GridVisualStyles.Metro; 
this.scheduleControl1.ScheduleGridCreated += ScheduleControl1_ScheduleGridCreated; 
this.scheduleControl1.Appearance.WeekMonthFullFormat = "yyyy-mm-dd"; 
private voidScheduleControl1_ScheduleGridCreated(object sender,ScheduleGridCreatedEventArgs e) 
{ 
    if (e.Schedule.ScheduleType ==ScheduleViewType.Week) 
    { 
        e.Grid = new ScheduleGrid(e.Schedule.Calendar, e.Schedule, e.InitialDate); 
        e.Schedule.Appearance.WeekMonthFullFormat ="yyyy-MM-dd"; 
        e.Handled = true; 
    } 
} 
We need an example that converts date format 'mm, yyyy' to 'yyyy-mm' in SchedulerControl calendar navigator; 
To change the date format for calendar navigator, you could the QueryCellInfo event. Please refer the following code example. 
  
C# 
this.scheduleControl1.Calendar.CalenderGrid.QueryCellInfo += CalenderGrid_QueryCellInfo; 
private voidScheduleControl1_ScheduleGridCreated(object sender,ScheduleGridCreatedEventArgs e) 
{ 
    if (e.Schedule.ScheduleType ==ScheduleViewType.Week) 
    { 
        e.Grid = new ScheduleGrid(e.Schedule.Calendar, e.Schedule, e.InitialDate); 
        e.Schedule.Appearance.WeekMonthFullFormat ="yyyy-MM-dd"; 
        e.Handled = true; 
    } 
} 
  
  
Please get back to us if you need any further assistance on this. 
  
Regards, 
Jagadeesan 



SL Smart law developer June 19, 2019 05:16 PM UTC

Thanks to Jagadeesan Pichaimuthu [Syncfusion].
I was able to solve it perfectly with the sample source you created.
Thank you.

Write down some of the code for other developers.         int rowsPerCol = 8;
        private void CalenderGrid_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
        {
            if (e.ColIndex == 1 && e.RowIndex % rowsPerCol == 0)
            {
                int cal = e.RowIndex / rowsPerCol;
                DateTime dt = this.scheduleControl1.Calendar.DateValue.AddMonths(cal);
                dt = dt.AddDays(-dt.Day + 1);
                e.Style.Text = dt.ToString("yyyy-MMMM", this.scheduleControl1.Calendar.CalenderGrid.TableStyle.CultureInfo);
            }
        }


JP Jagadeesan Pichaimuthu Syncfusion Team June 20, 2019 07:17 AM UTC

Hi Smart, 
 
Thanks for your update. 
 
We are glad to know that the provided solution worked at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Jagadeesan 


Loader.
Live Chat Icon For mobile
Up arrow icon