Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Syntax
Date.Month(dateTime as any) as nullable number
About
Returns the month component of the provided datetime value, dateTime.
Example 1
Find the month number of a datetime value.
Usage
Date.Month(#datetime(2011, 12, 31, 9, 15, 36))
Output
12
Example 2
Extract the month number from each date in a table.
Usage
Table.AddColumn(
Table.FromRecords({
[Name = "Order1", OrderDate = #date(2024, 1, 15)],
[Name = "Order2", OrderDate = #date(2024, 6, 20)],
[Name = "Order3", OrderDate = #date(2024, 11, 5)]
}),
"Month",
each Date.Month([OrderDate]),
Int64.Type
)
Output
Table.FromRecords({
[Name = "Order1", OrderDate = #date(2024, 1, 15), Month = 1],
[Name = "Order2", OrderDate = #date(2024, 6, 20), Month = 6],
[Name = "Order3", OrderDate = #date(2024, 11, 5), Month = 11]
})