# date()

Returns a date that can be used in a filter. This function takes a year, a month, and a day dimension as input.

## Syntax

`date(year, month, day)`

## Usage

Specify the year, month, and day. Each input value must be a date dimension type.

```nolang
date('OrderDate_Year', 'OrderDate_Month', 'OrderDate_Day')
```

## Example

Which opportunities have your reps closed in the past 30 days? Use `date()` to select records with a close date in the past 30 days.

```nolang
q = load "DTC_Opportunity";

-- use date() to create a date that you can use in a filter
-- 'CloseDate_Year', 'CloseDate_Month', and 'CloseDate_Day' are date fields in the DTC_Opportunity data set

q = filter q by date('CloseDate_Year', 'CloseDate_Month', 'CloseDate_Day') in ["30 days ago".."current day"];
q = group q by 'Account_Owner';
q = foreach q generate 'Account_Owner' as 'Account_Owner', sum('Amount') as 'sum_Amount';
q = order q by 'Account_Owner' asc;
```

**See Also**

- [toDate()](/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-todate.md)
- [Time-Based Filtering](/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-daterange.md)
