If you have dates stored as text and you want Power Query to treat them as real dates, Date.FromText is the function that does the conversion.
It reads a text value like "2024-08-19" and returns a proper date you can sort, filter, and do date math with.
Syntax of Date.FromText Function
Date.FromText(text as nullable text, optional options as any) as nullable date
where
text(required, nullable text). The text value to convert into a date, such as"2024-08-19".options(optional, any). Either a culture string like"en-US", or a record withFormatandCulturefields that tells Power Query exactly how to read the text. Omit it and Power Query best-effort parses using the current culture.
Returns: a date value built from the text. If text is null, it returns null. Text it cannot parse throws an error.
So you hand it a date written as text and it gives you back a real date. The options record is there for when the format is ambiguous.
Example 1: Convert an ISO date string to a date
Take a date written in the standard yyyy-MM-dd format and turn it into a real date.
let
Source = Date.FromText("2024-08-19")
in
Source
Result: 2024-08-19
The ISO layout is unambiguous, so no options record is needed. Power Query reads year, month, and day in order.
Example 2: Read a UK-format date with Format and Culture
A date like "19/08/2024" is day-first. Without help, an en-US reader would see month 19 and fail, or worse, misread a value like 03/04 as the wrong month.
Pass an options record to spell out the layout:
let
Source = Date.FromText("19/08/2024",[Format="dd/MM/yyyy",Culture="en-GB"])
in
Source
Result: 2024-08-19
Format="dd/MM/yyyy" tells Power Query the first number is the day, and Culture="en-GB" sets the regional rules. The text is now read as 19 August.
Example 3: Parse text that uses a month name
Some sources write the month out in full, like "03 March 2025". The MMMM token in the format string matches a full month name.
let
Source = Date.FromText("03 March 2025",[Format="dd MMMM yyyy",Culture="en-US"])
in
Source
Result: 2025-03-03
Format="dd MMMM yyyy" maps day, full month name, and year. Culture="en-US" tells it which language March belongs to.
Example 4: Convert a text date column into real dates
This is the everyday job. A table arrives with dates stuck as text, and you need a real date column to work with.
Say you have a Bookings table where ClassDate is text in dd/MM/yyyy form.
Here is the starting data:
| Member | ClassDate |
|---|---|
| Priya Nair | 14/05/2023 |
| Tom Wexler | 22/11/2023 |
| Aoife Byrne | 27/01/2024 |
Add a new column that runs Date.FromText on each ClassDate value:
let
Source = Excel.CurrentWorkbook(){[Name="Bookings"]}[Content],
AddDate = Table.AddColumn(Source,"ParsedDate",each Date.FromText([ClassDate],[Format="dd/MM/yyyy",Culture="en-GB"]),type date),
Result = Table.SelectColumns(AddDate,{"Member","ParsedDate"})
in
Result
The each keyword applies the conversion row by row, and type date tags the new column so Power Query treats it as dates.
The result keeps the member and the parsed date:
| Member | ParsedDate |
|---|---|
| Priya Nair | 2023-05-14 |
| Tom Wexler | 2023-11-22 |
| Aoife Byrne | 2024-01-27 |
Each text value is now a real date you can sort or filter on.
Example 5: A null input returns null
If a cell is empty, the text coming in is null. Date.FromText passes that straight through.
let
Source = Date.FromText(null)
in
Source
Result: null
A null in gives a null out, so blank cells do not break the query. Unparseable text is the case that errors, not a blank.
Things to keep in mind with Date.FromText
- Ambiguous formats need an
optionsrecord. A value like"03/04/2025"is read as March or April depending on culture. Pass[Format="dd/MM/yyyy",Culture="en-GB"](or the layout you actually have) to remove the guesswork. - Unparseable text throws an error. Junk like
"not a date"returnsExpression.Error: We couldn't parse the input provided as a Date value.Wrap it intry Date.FromText([Col]) otherwise nullto keep the query running. Formattokens are case-sensitive.MMis month,mmis minutes,ddis day. A wrong token reads the wrong part of the string.
Common questions about Date.FromText
What is the difference between Date.FromText and Date.ToText?
They are opposites. Date.FromText turns text into a date, while Date.ToText turns a date back into formatted text for display.
Can I convert a whole column at once?
Not with a bare Date.FromText, which takes a single value. Wrap it in Table.AddColumn with each, as in Example 4, to run it down a column. Once the column is real dates, you can combine it with other columns or compare it to today’s date in Power Query.
List of All Power Query Functions
Related Power Query Functions / Articles:
- Number.ToText Function
- Date.AddDays Function
- Table.TransformColumnTypes Function
- DateTime.LocalNow Function
- Duration.Days Function
- List.Dates Function
- Text.AfterDelimiter Function
- Calculate Date Difference in Power Query (Days, Months, Years)
- Text.From Function
- Date.DayOfWeek Function
- Date.From Function
- Date.EndOfMonth Function