Skip to main content
Row

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DateGrouping Class

A criterion for date values.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v24.2.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

#Declaration

public class DateGrouping

#Remarks

When filtering a column containing dates, use the AutoFilterColumn.ApplyFilterCriteria method to specify criteria for date values or modify an existing filter criteria.

The following picture shows the AutoFilter dialog for a column with certain data applying a filter that uses the DateGrouping with the DateGrouping.Value property set to DateTime(2015, 3, 1) and the DateGrouping.GroupingType set to DateTimeGroupingType.Month.

DateGrouping_AutoFillter_Dialog

#Example

View Example

Worksheet worksheet = workbook.Worksheets["Regional sales"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Enable filtering for the specified cell range.
CellRange range = worksheet["B2:E23"];
worksheet.AutoFilter.Apply(range);

// Create date grouping item to filter January 2015 dates.
IList<DateGrouping> groupings = new List<DateGrouping>();
DateGrouping dateGroupingJan2015 = new DateGrouping(new DateTime(2015, 1, 1), DateTimeGroupingType.Month);
groupings.Add(dateGroupingJan2015);

// Filter the data in the "Reported Date" column to display values reported in January 2015.
worksheet.AutoFilter.Columns[3].ApplyFilterCriteria("gennaio 2015", groupings);

#Inheritance

Object
DateGrouping
See Also