---
schema_version: "1"
id: 124114487ab4cd2c26a4cba3b696be2efa93c0678f447163ddabb6381896f994
title: week_first_day({date})
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-week-first-day.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-date-week-first-day.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5ac02d9b62cb7fa8782436ddf7c90be93e60fa6dc87cfa8ac670bc90ed7980ea
products:
  - SQL for Analytics Developer Guide
  - analytics
---

# week_first_day({date})

Accepts a `DateTime`, `DateOnly`, or legacy Date object as input. Returns an object of the same type that corresponds to the first day (Sunday) of the week that contains the specified date.

## Example

```nolang
SELECT OrderDate as "date", week_first_day(OrderDate) as "week_first_day" FROM "dates_sample_data";
```

| date                | week_first_day      |
| ------------------- | ------------------- |
| 2015-01-21 15:30:00 | 2015-01-18 00:00:00 |
| 2015-01-21 00:00:00 | 2015-01-18 00:00:00 |
| 2015-01-31 10:00:30 | 2015-01-25 00:00:00 |
| 2015-02-03 15:30:00 | 2015-02-01 00:00:00 |
| 2016-01-21 23:59:59 | 2016-01-17 00:00:00 |
| 2015-10-31 23:59:59 | 2015-10-25 00:00:00 |
| 2015-12-03 00:00:00 | 2015-11-29 00:00:00 |
| 2016-01-11 03:30:00 | 2016-01-10 00:00:00 |
| 2016-01-11 03:30:00 | 2016-01-10 00:00:00 |
