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