Crystal Reports: CDateRange() Function

Convert a string value into its equivalent Date Range.

Function (Stringvar dateRange)
Select dateRange
Case "Aged0To30Days" : Aged0To30Days
Case "Aged31To60Days" : Aged31To60Days
Case "Aged61To90Days" : Aged61To90Days
Case "AllDatesFromToday" : AllDatesFromToday
Case "AllDatesFromTomorrow" : AllDatesFromTomorrow
Case "AllDatesToToday" : AllDatesToToday
Case "AllDatesToYesterday" : AllDatesToYesterday
Case "Calendar1stHalf" : Calendar1stHalf
Case "Calendar1stQtr" : Calendar1stQtr
Case "Calendar2ndHalf" : Calendar2ndHalf
Case "Calendar2ndQtr" : Calendar2ndQtr
Case "Calendar3rdQtr" : Calendar3rdQtr
Case "Calendar4thQtr" : Calendar4thQtr
Case "Last4WeeksToSun" : Last4WeeksToSun
Case "Last7Days" : Last7Days
Case "LastFullMonth" : LastFullMonth
Case "LastFullWeek" : LastFullWeek
Case "LastYearMTD" : LastYearMTD
Case "LastYearYTD" : LastYearYTD
Case "MonthToDate" : MonthToDate
Case "Next30Days" : Next30Days
Case "Next31To60Days" : Next31To60Days
Case "Next61To90Days" : Next61To90Days
Case "Next91To365Days" : Next91To365Days
Case "Over90Days" : Over90Days
Case "WeekToDateFromSun" : WeekToDateFromSun
Case "YearToDate" : YearToDate
Case "Yesterday" : CurrentDate-1 To CurrentDate-1
Default: YearToDate


string equivalent of a Crystal Reports’ Date Range.

Return Value

Date Range


This function is useful when a report needs to provide a means to prompt on named date ranges, rather than a starting and ending date. See Business Objects Enterprise: Create a dynamic list of date ranges for an example.


'converts the 'Date Range' parameter (a list of strings) to an actual Date Range.
{Orders.OrderDate} IN CDateRange({?Date Range})


This function requires the use of Crystal Syntax.

1 thought on “Crystal Reports: CDateRange() Function

  1. Isaac

    I need to enter a date range of Next91To180Days, is there a way to work around the apparent limitation of these parameters? I see no Case available addressing this date range. Please help.

Leave a Reply

Your email address will not be published. Required fields are marked *