#date

Date

Creates a date value from year, month, and day components.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

#date(year as number, month as number, day as number) as date

Parameters

NameTypeRequiredDescription
yearnumberYesThe year component (e.g. 2024).
monthnumberYesThe month component (1–12).
daynumberYesThe day component (1–31, depending on month).

Return Value

dateA date value representing the specified calendar date.

Remarks

#date is M's literal constructor for creating date values. It is the canonical way to write a specific calendar date inline in M code.

The arguments must be valid calendar values — out-of-range values (e.g. month 13, day 32) produce an error at evaluation time.

#date produces a value of type date only (no time component). To construct a datetime, use #datetime. To convert a date to a datetime, use DateTime.From.

Examples

Example 1: Create a date literal

#date(2024, 3, 15)
Result
Result
13/15/2024

Example 2: Use a date literal in arithmetic

let
    start = #date(2024, 1, 1),
    end   = #date(2024, 12, 31),
    days  = Duration.Days(end - start)
in
    days
Result
Result
1365

Example 3: Add days to a date literal

#date(2024, 1, 1) + #duration(30, 0, 0, 0)
Result
Result
11/31/2024

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks