Date.From is a Power Query M function that returns a date value from the given value, with an optional culture parameter. The function returns a date value based on the input type.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Date.From(
value as any,
optional culture as nullable text,
) as nullable date
Description
Returns a date
value from the given value
. An optional culture
may also be provided (for example, “en-US”).
If the given value
is null
, Date.From
returns null
. If the given value
is date
, value
is returned. Values of the following types can be converted to a date
value:
text
: Adate
value from textual representation. Refer toDate.FromText
for details.datetime
: The date component of thevalue
.datetimezone
: The date component of the local datetime equivalent ofvalue
.number
: The date component of the datetime equivalent of the OLE Automation Date expressed byvalue
.
value
is of any other type, an error is returned.
Examples
Convert 43910
to a date
value.
// Output: #date( 2020, 3, 20 )
Date.From( 43910 )
Convert #datetime( 1899, 12, 30, 06, 45, 12 )
to a date
value.
// Output: #date( 1899, 12, 30 )
Date.From( #datetime( 1899, 12, 30, 06, 45, 12 ) )
Related functions
Other functions related to Date.From are:
