---
schema_version: "1"
id: 8d5ee817d3e0e61ad73f9b37598a9d5be58231c39664ee902528e0211bc25f9d
title: Access Date Functions with Time Zone Enabled
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_saql/guides/concept/bi-saql-functions-timezone-access.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-timezone-access.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1fbbdf0f687f938f03db7af36df4442d290c0febc50ed4b13dbff1fbc59afbfc
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# Access Date Functions with Time Zone Enabled

Use these functions to get the day, week, year, and other parts of `DateTime` or `DateOnly` fields. The return values are numbers.

To enable Time Zone for your org, follow the directions in [Enable Custom Time Zones](https://help.salesforce.com/s/articleView?id=analytics.bi_setup_time_zone_support.htm&type=5).

For the allowed formats, see [Date Formats](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-date-formats.md).

- `year (DateTime | DateOnly)`
- `quarter (DateTime | DateOnly)`
- `month (DateTime | DateOnly)`
- `week (DateTime | DateOnly)`
- `day (DateTime | DateOnly)`
- `hour (DateTime)`
- `minute (DateTime)`
- `second (DateTime)`
- `fiscalYear (DateTime | DateOnly)`
- `fiscalQuarter (DateTime | DateOnly)`
- `fiscalMonth (DateTime | DateOnly)`
- `fiscalWeek (DateTime | DateOnly)`
- `epochDay (DateTime | DateOnly)`
- `epochSecond( DateTime | DateOnly)`

## Examples

Use `year()`, `month()`, and `day()` to project the year, month, and day for each record. `CloseDate` can be a `DateTime` or `DateOnly` type.

```nolang
q = foreach q generate year('CloseDate') as "Year", month('CloseDate') as "Month", day('CloseDate') as "Day";
```

Use `month()` to find results that closed in December.

```nolang
q = filter q by month('CloseDate') == 12;
```

Use `month()` to order opportunities by month of close date.

```nolang
q = order q by month('CloseDate');
```

For even more granularity, add `hour()`, `minute()`, and `second()` to project the time for each record. These functions can only be used with a `DateTime` type.

```nolang
q = foreach q generate year('CloseDate') as "Year", month('CloseDate') as "Month", day('CloseDate') as "Day",
          hour('CloseDate') as "Hour", minute('CloseDate') as "Minute", second('CloseDate') as "Second";
```

Use `hour()` to order opportunities by hour of close date.

```nolang
q = order q by hour('CloseDate');
```
