The DateTime.From function converts a value into a date and time. You give it text like “3/9/2026 2:30 PM”, a date, a time, or an Excel serial number, and it gives you back a datetime value you can sort, filter, and do math with.
In this article, I’ll show you how DateTime.From works with practical examples, including UK and European date formats, Unix timestamps, and values that can’t be converted.
Follow along with the example file
DateTime.From Function Examples.xlsx
DateTime.From Function Syntax
DateTime.From(value as any, optional culture as nullable text) as nullable datetime
- value – the value you want to convert to a date and time. It can be text, a date, a time, a number, a datetime, or a datetimezone.
- culture (optional) – a culture code such as “en-US” or “en-GB”. It tells DateTime.From how to read text, like whether 09/03/2026 means September 3 or March 9. If you leave it out, it uses the regional settings Power Query runs with.
What it returns – the value as a datetime. If the value is null, you get null back, and if it’s already a datetime, you get the same value.
Here’s what each type of input turns into:
- Text – the date and time the text describes. A date with no time gets 12:00:00 AM.
- Date – that date at 12:00:00 AM (midnight).
- Time – that time on December 30, 1899, which is day zero in the date system Power Query uses.
- Number – the date and time that serial number stands for, so 46090.75 is March 9, 2026 at 6:00 PM.
- Datetimezone – the same moment in your computer’s local time, with the time zone part dropped.
Text it can’t read as a date gives the error “We couldn’t parse the input provided as a DateTime value.” Other types, like TRUE/FALSE or a duration, give “We couldn’t convert to DateTime.”
The DateTime.From function is part of the Power Query M language, so it works wherever Power Query does in Excel: Excel 365, 2024, 2021, 2019, and 2016 for Windows, and Excel for Microsoft 365 on Mac.
When to Use the DateTime.From Function
Use this function when you need to:
- Turn timestamps that came in as text into real date and time values
- Do date and time math when one column is a date and the other is a date and time
- Convert Excel serial numbers and Unix timestamps into readable dates and times
- Read dates written in the UK or European day/month order
- Read each row with its own regional format, using a culture code from another column
- Convert a column that has a mix of serial numbers and text dates
- Replace values that can’t be converted with null (using try … otherwise), instead of getting errors
Example 1: Convert Text to a Date and Time
Let’s start with a simple one.
In Excel, go to Data > Get Data > From Other Sources > Blank Query. In the Power Query Editor that opens, type this formula in the formula bar:
= DateTime.From("2026-03-09 14:30")
Result: 3/9/2026 2:30:00 PM

Here, DateTime.From reads the text “2026-03-09 14:30” and gives you the datetime for March 9, 2026 at 2:30 PM.
Power Query shows the result in your computer’s regional date and time format. My computer uses US settings, so the month comes first, but on a computer with UK settings the day comes first for the same value.
The year-month-day order is a safe way to write dates as text. I tried it with UK, German, French, and Japanese culture codes, and it gave March 9 every time.
Be careful with text that has only a time, like “2:30 PM”. DateTime.From adds today’s date to it, so the date changes every day the query refreshes.
Example 2: Convert a Text Column to Date and Time
This is the most common reason to use DateTime.From.
Below is a GymCheckIns table with each member and the time they checked in, where the check-in times came in as text, and I want them as real date and time values in column C.

To follow along, select any cell in the GymCheckIns table and go to Data > From Table/Range. This opens the table in the Power Query Editor, where the Source step holds it.
If Power Query also adds a Changed Type step, delete it. That step may convert the Checked In column for you, and the formulas in this article build on the Source step.
Now add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(Source,"Check-In Time",each DateTime.From([Checked In]),type datetime)
Result: A new Check-In Time column with 3/9/2026 6:15:00 AM, 3/9/2026 7:40:00 AM, 3/9/2026 12:05:00 PM, and 3/9/2026 6:30:00 PM.

Here, the Table.AddColumn function adds the new column, and DateTime.From turns each text value into a datetime. The last argument, type datetime, sets the data type of the new column to Date/Time.
The text and the new values look almost the same, but now you can sort them in time order, filter by time, or pull out the hour.
This works because my computer uses US settings, where the month comes first. If yours uses day/month order, these values may convert to the wrong dates or give errors, and Example 6 shows how to fix that with the culture argument.
If you don’t need to keep the original text, you can also change the column’s type instead (right-click the header and choose Change Type > Date/Time). DateTime.From is the one to use inside a formula, as in the next example.
Example 3: Subtract a Date From a Date and Time
Here’s a situation where Power Query refuses to do the math until you convert one side.
Below is an OnlineOrders table with each order’s date (no time) and the date and time it was delivered, and I want the number of hours each delivery took in column D.

Load the OnlineOrders table into Power Query the same way as in Example 2. This time, keep the Changed Type step and make sure its formula sets Order Date as a date and Delivered as a date and time, like this:
= Table.TransformColumnTypes(Source,{{"Order Date",type date},{"Delivered",type datetime}})
Then add a new step (by clicking on the fx icon next to the formula bar) and try to subtract the order date from the delivery time directly:
= Table.AddColumn(#"Changed Type","Hours to Deliver",each Duration.TotalHours([Delivered]-[Order Date]),type number)
Result: Every row in the Hours to Deliver column shows Error.

Click any Error cell and you’ll see the message “We cannot apply operator – to types DateTime and Date.” Power Query won’t subtract a date from a date and time, even though both hold a date.
So convert the order date to a datetime first. Replace the formula in the step you just added with this one:
= Table.AddColumn(#"Changed Type","Hours to Deliver",each Duration.TotalHours([Delivered]-DateTime.From([Order Date])),type number)
Result: A new Hours to Deliver column with 40.5, 59, 19.75, and 57.25.

Here, DateTime.From turns each order date into that date at midnight. Subtracting it from the delivery time gives a duration, and the Duration.TotalHours function turns that duration into a number of hours.
For order ORD-1041, that’s midnight on March 2 to 4:30 PM on March 3, which is 40.5 hours. Order Date stays a date column, since DateTime.From only converts the value inside the formula.
Example 4: Convert Excel Serial Numbers to Date and Time
Some systems export dates and times as Excel serial numbers instead of readable dates.
Below is a ParkingLog table with each parking bay and the time a car entered it, stored as a serial number, and I want the readable date and time in column C.

Load the ParkingLog table into Power Query the same way as in Example 2. Then add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(Source,"Entry Time",each DateTime.From([Entry Serial]),type datetime)
Result: A new Entry Time column with 3/9/2026 6:00:00 AM, 3/9/2026 9:00:00 AM, 3/9/2026 1:30:00 PM, and 3/9/2026 7:30:00 PM.

In a serial number, the whole part counts days and the decimal part is the fraction of a day. So 46090 is March 9, 2026, and the .25 in 46090.25 is a quarter of a day, which is 6:00 AM.
DateTime.From uses the same day count Excel uses for dates. That’s why you get the same date and time here as you would by formatting these numbers as dates in Excel.
If you don’t need to keep the serial numbers, changing the column’s type to Date/Time does the same conversion.
Example 5: Convert Unix Timestamps to Date and Time
Many web apps, databases, and sensors record time as a Unix timestamp, which is the number of seconds since January 1, 1970.
Below is a FreezerReadings table with each sensor’s temperature reading and the Unix time it was taken, and I want that time as a date and time in column D.

Load the FreezerReadings table into Power Query the same way as in Example 2. Then add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(Source,"Reading Time (UTC)",each DateTime.From([Unix Time]/86400+25569),type datetime)
Result: A new Reading Time (UTC) column with 3/9/2026 8:00:00 AM, 3/9/2026 9:15:00 AM, 3/9/2026 12:30:00 PM, and 3/9/2026 5:45:00 PM.

Here, dividing by 86400 (the number of seconds in a day) turns the seconds into days. Adding 25569 moves the count to the Excel day count, since 25569 is the serial number of January 1, 1970.
DateTime.From then converts that serial number to a datetime, the same way as in Example 4. Unix time is in UTC, so these times are UTC too, not your local time.
This formula expects seconds. If your timestamps have 13 digits, they’re in milliseconds, so divide by 86400000 instead of 86400.
You can also get the same result without DateTime.From, by adding the seconds to January 1, 1970: #datetime(1970,1,1,0,0,0)+#duration(0,0,0,[Unix Time]).
If you try to change the Unix Time column’s type to Date/Time directly, you get an error, because the number is far too big to be a serial number.
Follow along with the example file
DateTime.From Function Examples.xlsx
Example 6: Read Dates Written in the UK Format
This is where the second argument, culture, comes in. It’s a code like “en-US” (US) or “en-GB” (UK) that tells DateTime.From whether the day or the month comes first.
Below is a HotelBookings table from a UK hotel, where the check-in times are written as day/month/year, and I want them as date and time values in column C.

Load the HotelBookings table into Power Query the same way as in Example 2. Then add a new step (by clicking on the fx icon next to the formula bar) and first try it without a culture:
= Table.AddColumn(Source,"Check-In Time",each DateTime.From([#"Check-In"]),type datetime)
Result: Timothy gets 9/3/2026 2:00:00 PM, Jeffrey gets 5/4/2026 12:00:00 PM, and Lisa and Wendy show Error.

My computer uses US settings, so DateTime.From reads the first number as the month. Timothy’s 09/03/2026 becomes September 3 instead of March 9, which is wrong without any warning.
Lisa’s 14/03/2026 fails, because there’s no 14th month. You get the error “We couldn’t parse the input provided as a DateTime value.”
Now tell DateTime.From that the text is in the UK format. Replace the formula in the step you just added with this one:
= Table.AddColumn(Source,"Check-In Time",each DateTime.From([#"Check-In"],"en-GB"),type datetime)
Result: The Check-In Time column now shows 3/9/2026 2:00:00 PM, 3/14/2026 3:30:00 PM, 4/5/2026 12:00:00 PM, and 4/21/2026 4:00:00 PM.

Here, “en-GB” is the culture code for English (United Kingdom), where the day comes before the month. So 09/03/2026 is read as March 9, and every row converts.
The new column shows the dates in my US format (month first). On a computer with UK settings, the same values show day first, but they’re the same dates.
If you only need to convert the whole column, right-click its header and choose Change Type > Using Locale, then pick Date/Time and English (United Kingdom).
If you leave out the culture argument, DateTime.From uses the regional settings Power Query runs with. So the same query can give different dates on another computer, which is why it’s safer to pass the culture when you know where the data came from.
Example 7: Use a Different Culture for Each Row
Sometimes one table has dates written the way each country writes them.
Below is a Dispatches table with each warehouse, its culture code, and the dispatch time written the local way, and I want every dispatch time as a date and time in column D.

Load the Dispatches table into Power Query the same way as in Example 2. Then add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(Source,"Dispatch Time",each DateTime.From([Dispatched],[Culture]),type datetime)
Result: A new Dispatch Time column with 3/9/2026 2:30:00 PM, 3/10/2026 8:15:00 AM, 3/11/2026 4:45:00 PM, and 3/12/2026 11:00:00 AM.

Here, DateTime.From gets its culture code from the Culture column of each row.
So Berlin’s “09.03.2026 14:30” is read the German way, and Paris’s “10 mars 2026 08:15” is read with the French month name. London’s “12/03/2026 11:00” is read as March 12, while Chicago’s US-style text is read month first.
Changing the column type can only use one culture for the whole column, so a per-row culture like this needs DateTime.From.
Make sure every row has a culture code. If a Culture cell is blank, DateTime.From quietly falls back to your own regional settings for that row.
Example 8: Convert a Column With Both Numbers and Text
When data comes from different sources, one column can end up with serial numbers in some rows and text dates in others. This happens, for example, when some dates were pasted as values and others were typed in as text.
Below is a ServiceLog table with the last service time of each machine, where two times are serial numbers and two are text, and I want all of them as date and time values in column C.

Load the ServiceLog table into Power Query the same way as in Example 2. Then add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(Source,"Service Time",each DateTime.From([Last Service]),type datetime)
Result: A new Service Time column with 3/9/2026 9:00:00 AM, 3/10/2026 2:15:00 PM, 3/11/2026 1:30:00 PM, and 3/12/2026 8:45:00 AM.

DateTime.From takes a value of any type. It converts the serial number 46090.375 the way Example 4 does, and the text “3/10/2026 2:15 PM” the way Example 2 does, so both kinds of cells work.
Taking any type is where DateTime.From differs from the DateTime.FromText function, which only takes text. DateTime.FromText([Last Service]) would give the error “We cannot convert the value 46090.375 to type Text.” on the rows that hold a number.
Changing the column’s type to Date/Time would also convert both kinds, so use that if you don’t need to keep the original column.
Example 9: See What DateTime.From Returns for Different Value Types
DateTime.From works on more than text. This example puts one value of each common type side by side, so you can see the date and time you get for each.
Create a new blank query, open the Advanced Editor (Home > Advanced Editor), and use this code:
let
Source = #table({"Type","Value"},{{"Text","2026-03-09 14:30"},{"Date",#date(2026,3,9)},{"Time",#time(14,30,0)},{"Number",46090.75},{"Date/Time",#datetime(2026,3,9,14,30,0)},{"Null",null}}),
#"Added DateTime" = Table.AddColumn(Source,"As DateTime",each DateTime.From([Value]),type datetime)
in
#"Added DateTime"
Result: The As DateTime column shows 3/9/2026 2:30:00 PM, 3/9/2026 12:00:00 AM, 12/30/1899 2:30:00 PM, 3/9/2026 6:00:00 PM, 3/9/2026 2:30:00 PM, and null.

Here, the Source step builds a small table with the #table function, and the Added DateTime step runs DateTime.From on each value.
The date gets a time of midnight, and the time gets the date December 30, 1899, since a time on its own has no date. The datetime comes back unchanged, and null stays null.
To keep only the date part of a datetime, use the Date.From function instead.
Note that Date.From gives an error on text that includes a time, like “3/9/2026 6:30 PM”. For text like that, convert it with DateTime.From first and then take the date, as in Date.From(DateTime.From(“3/9/2026 6:30 PM”)), which gives 3/9/2026.
If you have a date column and a time column and want one datetime, you don’t need DateTime.From. The & operator joins them, so [Date] & [Time] gives the combined date and time.
Example 10: Handle Values That Can’t Be Converted
Real data often has entries like “N/A” in a date column, and DateTime.From can’t read those.
Below is a FormSubmissions table with the time each student submitted a form, where one entry is “N/A”, one is blank, and one says “pending”, and I want the submission times as date and time values in column C.

Load the FormSubmissions table into Power Query the same way as in Example 2. Then add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(Source,"Submitted At",each DateTime.From([Submitted]),type datetime)
Result: Dean and Tara get their date and time, Monica shows null, and Teresa and Carl show Error.

Click an Error cell and you’ll see “We couldn’t parse the input provided as a DateTime value.” DateTime.From only reads text that is a date, so “N/A” and “pending” fail.
The blank cell comes in as null, and DateTime.From returns null for it.
These errors also break later steps. If you sort or filter on this column, the whole step fails with the same error, so it’s better to turn them into null.
Replace the formula in the step you just added with this one:
= Table.AddColumn(Source,"Submitted At",each try DateTime.From([Submitted]) otherwise null,type datetime)
Result: Dean gets 3/2/2026 10:05:00 AM, Tara gets 3/4/2026 3:40:00 PM, and the other three rows show null.

Here, try runs DateTime.From, and if it gives an error, otherwise returns null instead. The values that convert fine are kept as they are.
Keep in mind that try hides the problem too. A typo in a real date, like “3/32/2026”, now looks the same as a blank, so check the Submitted column if every time matters.
If you’d rather not edit the formula, you can keep the first version and then right-click the column header, choose Replace Errors, and type null as the value. That does the same thing in a separate step.
Other Excel Articles You May Also Like:
- Duration.TotalDays Function in Power Query M
- Date.FromText – Use Date.FromText in Power Query M to convert text into real date values.
- Date.ToText – Use Date.ToText in Power Query M to convert dates to text.
- Number.From – Use Number.From in Power Query M to convert values to numbers.
- DateTime.LocalNow – Use DateTime.LocalNow in Power Query M to get the current date and time.
- Text.From – Use Text.From in Power Query M to convert values to text.
- Date.Month – Use Date.Month in Power Query M to get the month number from a date.
- Table.TransformColumnTypes – Use Table.TransformColumnTypes in Power Query M to set column data types.