---
schema_version: "1"
id: 7467251fba9746ac0c7df1152893a94317945c5fc2f936488685daf12f4f6a51
title: First Day in the Week, Month, Quarter, or Year
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_saql/guides/reference/bi-saql-functions-firstday.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-firstday.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 4fa4bab6684a7894c0ec79cb250c2db150d9c28ece1c3d8e25acd6039ae7ad99
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# First Day in the Week, Month, Quarter, or Year

Returns the date of the first day in the specified week, month, quarter, or year.

## Usage

Use these functions in a `foreach()` statement. You cannot use them in `group by`, `order by`, or `filter` statements.

Use the functions whose names begin with `week`, `month`, `quarter`, and `year` with standard calendar year dates. Use the functions whose names begin with `fiscal` with fiscal year dates.

**note:** You can't use fiscal date functions in recipes and dataflow transformations.

## week_first_day(date)

Returns the date of the first day of the week for the specified date.

```nolang
q = foreach q generate week_first_day(toDate('CloseDate_sec_epoch')) as 'Week First Day';
```

**note:** This function always counts the `firstDayOfWeek` as 0 (Sunday). It overrides the `firstDayOfWeek` parameter for `sfdcDigestTransformation` and CSV uploads.

## fiscal_week_first_day(date)

Returns the fiscal date of the first day of the week for the specified date.

```nolang
q = foreach q generate fiscal_week_first_day(toDate('CloseDate_sec_epoch')) as 'Fiscal Week First Day';
```

**note:** This function respects the `firstDayOfWeek` parameter for `sfdcDigestTransformation` and CSV uploads. The default value is 0 (Sunday).

## month_first_day(date)

Returns the date of the first day of the month for the specified date.

```nolang
q = foreach q generate month_first_day(toDate('CloseDate_sec_epoch')) as 'Month First Day';
```

## fiscal_month_first_day(date)

Returns the fiscal date of the first day of the month for the specified date.

```nolang
q = foreach q generate fiscal_month_first_day(toDate('CloseDate_sec_epoch')) as 'Fiscal Month First Day';
```

## quarter_first_day(date)

Returns the date of the first day of the quarter for the specified date.

```nolang
q = foreach q generate quarter_first_day(toDate('CloseDate_sec_epoch')) as 'Quarter First Day';
```

## fiscal_quarter_first_day(date)

Returns the fiscal date of the first day of the quarter for the specified date.

```nolang
q = foreach q generate fiscal_quarter_first_day(toDate('CloseDate_sec_epoch')) as 'Fiscal Quarter First Day';
```

## year_first_day(date)

Returns the date of the first day of the year for the specified date.

```nolang
q = foreach q generate year_first_day(toDate('CloseDate_sec_epoch')) as 'Year First day';
```

**note:** This function always returns 1st January.

## fiscal_year_first_day(date)

Returns the fiscal date of the first day of the year for the specified date.

```nolang
q = foreach q generate fiscal_year_first_day(toDate('CloseDate_sec_epoch')) as 'Fiscal Year First Day';
```

**See Also**

- [Date Formats and Fiscal Dates for Source Data](https://help.salesforce.com/s/articleView?id=bi_integrate_date_formats_and_fiscal_dates.htm)
