Date.From Function (Power Query M)

If you want to convert a value, such as a datetime, a text string, or a number, into a date in Power Query, the Date.From function is what you reach for. It returns a date value with no time component.

Available in Excel (Power Query), Power BI Desktop, and Power BI Service.

Syntax of Date.From Function

Date.From(value as any, optional culture as nullable text) as nullable date

where

  • value (required, any). The value to convert to a date. It accepts a date, datetime, datetimezone, text, or number.
  • culture (optional, nullable text). The culture used when parsing a text value, for example "en-GB". It only matters when value is text. When omitted, the machine locale is used.

Returns: a date value. If value is null, it returns null.

In plain terms, you hand it almost any date-like value and it gives you back just the date.

Example 1: Convert a datetime to a date

Take a #datetime value and pull out only the date part.

Date.From(#datetime(2024,3,15,9,30,0))

Result: 2024-03-15

The time (9:30:00) is dropped and you are left with the date.

Example 2: Convert an ISO text date

An ISO 8601 string like "2024-07-08" parses the same way on any machine, so no culture is needed.

Date.From("2024-07-08")

Result: 2024-07-08

Example 3: Convert ambiguous text with a culture

A string like "08/07/2024" is ambiguous. It could be 8 July or 7 August depending on the locale. Passing "en-GB" forces day/month order.

Date.From("08/07/2024","en-GB")

Result: 2024-07-08

With "en-GB", 08 is read as the day and 07 as the month, so the result is 8 July 2024. Without the culture argument, the same string would follow the machine locale and could come back as 7 August.

Example 4: Convert an Excel serial number

A plain number is read as an Excel-style serial, where the count of days runs from 30 December 1899.

Date.From(45366)

Result: 2024-03-15

The serial 45366 lands on 15 March 2024.

Example 5: Convert a datetime column to a date column

The most common real use is turning a whole datetime column into plain dates.

Say you have a CheckInLog query with a Member column and a CheckIn column that holds full timestamps.

Here is the starting data:

MemberCheckIn
A-1012024-01-05 07:45:00
A-1022024-01-05 18:20:00
A-1032024-01-06 12:05:00

Set the column to datetime using Table.TransformColumnTypes, then apply Date.From to every value:

let
Source = Excel.CurrentWorkbook(){[Name="CheckInLog"]}[Content],
Typed = Table.TransformColumnTypes(Source, {{"CheckIn", type datetime}}),
ToDate = Table.TransformColumns(Typed, {{"CheckIn", each Date.From(_), type date}})
in
ToDate

The result produces:

MemberCheckIn
A-1012024-01-05
A-1022024-01-05
A-1032024-01-06

Each timestamp keeps its date and loses its time, and the column is now typed as date.

Things to keep in mind with Date.From

  • It handles several input types. A datetime or datetimezone is reduced to its date part (the time is stripped). A datetimezone is converted to its local equivalent first, so the offset can shift the date.
  • A number uses the Excel serial system. The count of days runs from a base of 30 December 1899, and any fractional part (the time of day) is dropped.
  • Text parsing follows the culture. With no culture, an ambiguous string like "03/04/2024" is read using the machine locale and can misparse. Pass an explicit culture (see Example 3) to keep it deterministic.
  • null returns null. A blank value passes straight through without raising an error.
  • Any other type throws an error. If value is a type it cannot convert, the function returns an error rather than a date.
  • It pairs well with DateTime.LocalNow. Wrapping that in Date.From is a common way to get today’s date in Power Query as a clean date value.

Performance and query folding

Date.From is a local scalar conversion, so it runs on your machine rather than folding back to the source. For row-by-row column work, that is fine for the table sizes Power Query usually handles.

Common questions about Date.From

What is the difference between Date.From and Date.FromText?

Date.From accepts almost any date-like type (datetime, number, text, and more) and converts it to a date. Date.FromText only accepts text. Reach for Date.From when your input might not be a string. If you instead want to turn a date back into text, use Date.ToText.

List of All Power Query Functions

Related Power Query Functions / Articles:

I am a huge fan of Microsoft Excel and love sharing my knowledge through articles and tutorials. I work as a business analyst and use Microsoft Excel extensively in my daily tasks. My aim is to help you unleash the full potential of Excel and become a data-slaying wizard yourself.