DateTime.From
This function retrieves a datetime value based on the input provided. You may also specify a cultural format (e.g. "en-US"). If the input is empty, the function will return null. If the input is alrea...
This function retrieves a datetime value based on the input provided. You may also specify a cultural format (e.g. "en-US"). If the input is empty, the function will return null. If the input is already a datetime value, it will be returned as is. The following types can be converted into a datetime value: text (a datetime value in textual form), date (a datetime with the date component and time component set to 12:00:00 AM), datetimezone (the local datetime equivalent of the input value), time (a datetime with the date component set to 0 and the time component set to the input value), and number (a datetime equivalent of the OLE Automation Date determined by the input value). If the input is of any other type, an error will be generated.
Example 1
Transform the time 06:45:12 into a datetime value.
Procedure:
Use Power Query MDateTime.From(#time(06, 45, 12))
Result:
#datetime(1899, 12, 30, 06, 45, 12)
Example 2
Convert the date 1975-04-04 into a datetime value.
Procedure:
Utilize Power Query MDateTime.From(#date(1975, 4, 4))
Result:
#datetime(1975, 4, 4, 0, 0, 0)