private void CustomDateFormatInfo()
{
DateTime date = new DateTime(2014, 2, 14);
this.gcCalendarGrid1.DateFormatInfo.CultureInfo = new CultureInfo("en-US");
Console.WriteLine(this.gcCalendarGrid1.DateFormatInfo.FormatDate(date, CalendarDateFormats.LongDate, CalendarDateFormatType.CalendarGrid));
// Output "Friday, February 14, 2014"
this.gcCalendarGrid1.DateFormatInfo.CultureInfo = new CultureInfo("ja-JP");
Console.WriteLine(this.gcCalendarGrid1.DateFormatInfo.FormatDate(date, CalendarDateFormats.LongDate, CalendarDateFormatType.CalendarGrid));
// Output "2014年2月14日"
this.gcCalendarGrid1.DateFormatInfo.CalendarWeekRule = CalendarWeekRule.FirstDay;
this.gcCalendarGrid1.DateFormatInfo.FirstDayOfWeek = DayOfWeek.Sunday;
Console.WriteLine(this.gcCalendarGrid1.DateFormatInfo.FormatDate(date, CalendarDateFormats.WeekNumber, CalendarDateFormatType.CalendarGrid));
// Output "7"
this.gcCalendarGrid1.DateFormatInfo.CalendarWeekRule = CalendarWeekRule.FirstFullWeek;
this.gcCalendarGrid1.DateFormatInfo.FirstDayOfWeek = DayOfWeek.Monday;
Console.WriteLine(this.gcCalendarGrid1.DateFormatInfo.FormatDate(date, CalendarDateFormats.WeekNumber, CalendarDateFormatType.CalendarGrid));
// Output "6"
this.gcCalendarGrid1.DateFormatInfo.DayOfWeekNames = "Sun(日),Mon(月),Tue(火),Wed(水),Thu(木),Fri(金),Sat(土)";
Console.WriteLine(this.gcCalendarGrid1.DateFormatInfo.FormatDate(date, CalendarDateFormats.DayOfWeek, CalendarDateFormatType.CalendarGrid));
// Output "Fri(金)"
this.gcCalendarGrid1.DateFormatInfo.RokuyouNames = "Taian,Syakkou,Sensyou,Tomobiki,Senbu,Butumetu";
Console.WriteLine(this.gcCalendarGrid1.DateFormatInfo.FormatDate(date, CalendarDateFormats.Rokuyou, CalendarDateFormatType.CalendarGrid));
// Output "Senbu"
}
Private Sub CustomDateFormatInfo()
Dim [date] As New DateTime(2014, 2, 14)
Me.gcCalendarGrid1.DateFormatInfo.CultureInfo = New CultureInfo("en-US")
Console.WriteLine(Me.gcCalendarGrid1.DateFormatInfo.FormatDate([date], CalendarDateFormats.LongDate, CalendarDateFormatType.CalendarGrid))
' Output "Friday, February 14, 2014"
Me.gcCalendarGrid1.DateFormatInfo.CultureInfo = New CultureInfo("ja-JP")
Console.WriteLine(Me.gcCalendarGrid1.DateFormatInfo.FormatDate([date], CalendarDateFormats.LongDate, CalendarDateFormatType.CalendarGrid))
' Output "2014年2月14日"
Me.gcCalendarGrid1.DateFormatInfo.CalendarWeekRule = CalendarWeekRule.FirstDay
Me.gcCalendarGrid1.DateFormatInfo.FirstDayOfWeek = DayOfWeek.Sunday
Console.WriteLine(Me.gcCalendarGrid1.DateFormatInfo.FormatDate([date], CalendarDateFormats.WeekNumber, CalendarDateFormatType.CalendarGrid))
' Output "7"
Me.gcCalendarGrid1.DateFormatInfo.CalendarWeekRule = CalendarWeekRule.FirstFullWeek
Me.gcCalendarGrid1.DateFormatInfo.FirstDayOfWeek = DayOfWeek.Monday
Console.WriteLine(Me.gcCalendarGrid1.DateFormatInfo.FormatDate([date], CalendarDateFormats.WeekNumber, CalendarDateFormatType.CalendarGrid))
' Output "6"
Me.gcCalendarGrid1.DateFormatInfo.DayOfWeekNames = "Sun(日),Mon(月),Tue(火),Wed(水),Thu(木),Fri(金),Sat(土)"
Console.WriteLine(Me.gcCalendarGrid1.DateFormatInfo.FormatDate([date], CalendarDateFormats.DayOfWeek, CalendarDateFormatType.CalendarGrid))
' Output "Fri(金)"
Me.gcCalendarGrid1.DateFormatInfo.RokuyouNames = "Taian,Syakkou,Sensyou,Tomobiki,Senbu,Butumetu"
Console.WriteLine(Me.gcCalendarGrid1.DateFormatInfo.FormatDate([date], CalendarDateFormats.Rokuyou, CalendarDateFormatType.CalendarGrid))
' Output "Senbu"
End Sub