---
schema_version: "1"
id: 35036c28f2ebcf58230c149a003180dbd5592e3b9eb10b4a5d5cf3b677828d44
title: Day of Year
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_sql/guides/bi-sql-date-doy.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-date-doy.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 4df8c9fb2152c096f16de384060c17fb0fc1c95b47e907eb856c9ca8b99530df
products:
  - SQL for Analytics Developer Guide
  - analytics
---

# Day of Year

Returns an integer that represents the day of the year for a specific date.

## Example

```nolang
SELECT OrderDate as "date", EXTRACT (DOY FROM OrderDate) as "day_of_year" FROM "dates_sample_data";
```

| date                | day_of_year |
| ------------------- | ----------- |
| 2015-01-21 15:30:00 | 21          |
| 2015-01-21 00:00:00 | 21          |
| 2015-01-31 10:00:30 | 31          |
| 2015-02-03 15:30:00 | 34          |
| 2016-01-21 23:59:59 | 21          |
| 2015-10-31 23:59:59 | 304         |
| 2015-12-03 00:00:00 | 337         |
| 2016-01-11 03:30:00 | 11          |
| 2016-01-11 03:30:00 | 11          |
