Skip to main content

DateTimePeriod Class

A date-time period that is used to select a predefined range in the Range Filter and Date Filter items.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v22.1.Core.dll

Declaration

public class DateTimePeriod :
    IXmlSerializableElement,
    IDateTimePeriodLimitOwner,
    INameContainer,
    INamedItem,
    ISupportPrefix,
    IDateTimePeriod

Remarks

The DateTimePeriod objects are predefined date-time periods in Range Filter and Date Filter items. The RangeFilterDashboardItem.DateTimePeriods and DateFilterDashboardItem.DateTimePeriods properties provide access to the collections of DateTimePeriod objects.

Use the DateTimePeriod static methods to create a predefined period. To create a custom period, instantiate the DateTimePeriod class and perform the following steps:

Example

This code snippet demonstrates how to create predefined DateTime periods for the Range Filter dashboard item.

View Example: How to Bind the Range Filter Dashboard Item to Data at Runtime

using DevExpress.DashboardCommon;
// ...
rangeFilter.DateTimePeriods.AddRange(
    DateTimePeriod.CreateLastYear(),
    DateTimePeriod.CreateNextDays("Next 7 Days", 7),
    new DateTimePeriod
    { Name = "Month To Date",
        Start = new FlowDateTimePeriodLimit(DateTimeInterval.Month,0),
        End = new FlowDateTimePeriodLimit(DateTimeInterval.Day,1)
    },
    new DateTimePeriod
    { Name = "Jul-18-2018 - Jan-18-2019",
        Start = new FixedDateTimePeriodLimit(new DateTime(2018, 7, 18)),
        End = new FixedDateTimePeriodLimit(new DateTime(2019, 1, 18)) }
    );
// Specify the period selected when the control is initialized.
rangeFilter.DefaultDateTimePeriodName = "Year To Date";

The following code snippets (auto-collected from DevExpress Examples) contain references to the DateTimePeriod class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Inheritance

Object
DateTimePeriod
See Also