Date.From
Creates a date from the given value.
Syntax
Date.From(
value as any,
optional culture as text
) as date
Remarks
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
Example #1
Convert <code>43910</code> to a <code>date</code> value.
Date.From(43910)
Result:
#date(2020, 3, 20)
Example #2
Convert <code>#datetime(1899, 12, 30, 06, 45, 12)</code> to a <code>date</code> value.
Date.From(#datetime(1899, 12, 30, 06, 45, 12))
Result:
#date(1899, 12, 30)
Category
Date