DateHelper
Provides date-boundary and navigation calculations used by scheduler views and recurrence rules.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.Scheduler.dll
Syntax:
public static class DateHelper
Inheritance: objectDateHelper
Methods
Moves a date by the requested navigation unit using the scheduler's calendar. Week steps add seven days per step; day and unrecognized values use day arithmetic.
public static DateTime GetDateWithOffset(DateTime date, NavigationStepTypes navigationStepType, int navigationStep, RadScheduler scheduler)
The date from which to calculate.
navigationStepTypeNavigationStepTypesThe minute, hour, day, week, month, or year unit to apply; unrecognized values use days.
navigationStepintThe signed number of steps to apply.
schedulerRadSchedulerThe scheduler whose culture calendar performs the date arithmetic.
Returns:The date after applying the requested calendar offset.
Returns the last day of the date's calendar month at 23:59:59.
public static DateTime GetEndOfMonth(DateTime date, DateTimeFormatInfo dateTimeFormat)
A date in the month to inspect.
dateTimeFormatDateTimeFormatInfoThe culture-specific calendar used to determine the month's length.
Returns:The last day of the containing month at 23:59:59.
Returns the exclusive boundary after the week containing the date, using the specified first weekday.
public static DateTime GetEndOfWeek(DateTime date, DateTimeFormatInfo dateTimeFormat, DayOfWeek weekStart)
A date in the week to inspect.
dateTimeFormatDateTimeFormatInfoThe culture-specific calendar used to resolve the date's weekday.
weekStartDayOfWeekThe weekday that begins the week.
Returns:Midnight at the start of the following week.
Returns the exclusive boundary after the week containing the date, using the culture's configured first weekday.
public static DateTime GetEndOfWeek(DateTime date, DateTimeFormatInfo dateTimeFormat)
A date in the week to inspect.
dateTimeFormatDateTimeFormatInfoThe culture-specific calendar and first weekday.
Returns:Midnight at the start of the following week.
Calculates a year-end value using the supplied calendar's year length and the Gregorian Year anchor.
public static DateTime GetEndOfYear(DateTime date, DateTimeFormatInfo dateTimeFormat)
A date in the year to inspect.
dateTimeFormatDateTimeFormatInfoThe calendar used to obtain the year length.
Returns:The calculated year-end value at 23:59:59.
The Gregorian year anchor may not align with
dateTimeFormat's year when it is a non-Gregorian calendar.
Counts the week-sized rows needed to display the month containing the date. The first and last partial weeks are included.
public static int GetMonthDisplayWeeks(DateTime date, DateTimeFormatInfo dateTimeFormat)
A date in the month to display.
dateTimeFormatDateTimeFormatInfoThe culture-specific calendar and first weekday used for the row boundaries.
Returns:The number of seven-day display weeks spanning the month.
Returns midnight on the first day of the month containing the date, according to the supplied calendar.
public static DateTime GetStartOfMonth(DateTime date, DateTimeFormatInfo dateTimeFormat)
A date in the month to inspect.
dateTimeFormatDateTimeFormatInfoThe culture-specific calendar used to resolve the month.
Returns:The first day of the containing month at midnight.
Returns midnight at the start of the week containing the date, using the specified first weekday.
public static DateTime GetStartOfWeek(DateTime date, DateTimeFormatInfo dateTimeFormat, DayOfWeek weekStart)
A date in the week to inspect.
dateTimeFormatDateTimeFormatInfoThe culture-specific calendar used to resolve the date's weekday.
weekStartDayOfWeekThe weekday that begins the week.
Returns:The start date of the containing week.
Returns midnight at the start of the week containing the date, using the culture's configured first weekday.
public static DateTime GetStartOfWeek(DateTime date, DateTimeFormatInfo dateTimeFormat)
A date in the week to inspect.
dateTimeFormatDateTimeFormatInfoThe culture-specific calendar and first weekday.
Returns:The start date of the containing week.