Function Problems

Convert ISO Date-Time Text to an Excel Date

Huda QurayshiHuda Qurayshi Dec 2, 2026 868 views

Question details

Convert ISO date-time text into a numeric Excel date and time that can be formatted, sorted, and charted.

Convert ISO Date-Time Text to an Excel Date
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet contains values such as 2022-02-25T12:31:50.738072 that need to be used as dates and times.
Observed behavior
The date-time value is stored as text rather than as a usable Excel date and time.
Before you start

Check that the source values use the same structure as 2022-02-25T12:31:50.738072, with the date and time in fixed positions. The formula below assumes the first value is in cell A2.

Solution 1Recommended

Convert the text with DATE and TIME functions in Excel

Use this formula to create a numeric date and time without relying on Excel to interpret the text's date format.

The formula extracts the year, month, day, hour, minute, and second from fixed positions. It discards fractional seconds and does not apply a time-zone conversion.

1
Enter the conversion formula

Select an empty cell such as B2 and enter =DATE(VALUE(LEFT(A2,4)),VALUE(MID(A2,6,2)),VALUE(MID(A2,9,2)))+TIME(VALUE(MID(A2,12,2)),VALUE(MID(A2,15,2)),VALUE(MID(A2,18,2))). Press Enter.

2
Apply a date-time format

Select B2, open Format Cells, and choose Custom. Enter yyyy-mm-dd hh:mm:ss as the format, then apply it.

3
Convert the remaining rows

Drag the fill handle from B2 down alongside the source values. Use the converted column for sorting or select it when creating a chart.

Convert the text with DATE and TIME functions in Excel
Formula separators: If Excel rejects the formula, your regional settings may require semicolons instead of commas between function arguments.
Convert dates in WPS Spreadsheets

Convert ISO Date-Time Text in WPS Spreadsheets

Use a formula and a custom cell format in WPS Spreadsheets to turn fixed-position ISO date-time text into values you can sort and chart.

  1. 1. Open the spreadsheet: Open WPS Spreadsheets and select the workbook containing the ISO date-time text.
  2. 2. Enter the formula: If the first text value is in A2, select B2 and enter =DATE(VALUE(LEFT(A2,4)),VALUE(MID(A2,6,2)),VALUE(MID(A2,9,2)))+TIME(VALUE(MID(A2,12,2)),VALUE(MID(A2,15,2)),VALUE(MID(A2,18,2))). Press Enter.
  3. 3. Format the result: Select B2, open Format Cells, choose Custom, and enter yyyy-mm-dd hh:mm:ss.
  4. 4. Fill the column: Drag B2's fill handle down to convert the other rows, then use the resulting column for sorting or charting.
Convert ISO date-time text into numeric date and time valuesOpen and save Microsoft Excel XLSX and XLS filesFormat, sort, and chart converted dates in a familiar spreadsheet interfaceUse WPS Office for free
QA img-9

Frequently Asked Questions

Why does the converted date appear as a number?

Excel stores dates and times as numeric serial values. Select the result, open Format Cells, and choose a date-time format such as the custom format yyyy-mm-dd hh:mm:ss.

Does the formula retain fractional seconds?

No. It extracts only the whole seconds from positions 18 through 19. Use a different conversion method if subsecond precision is required.

Can I sort the converted values by date?

Yes. Select the converted column and use Excel's Sort command. Because the formula returns numeric date-time values, Excel can sort them chronologically.

Does the formula convert time zones?

No. It uses the date and time shown in the text and does not interpret a time-zone suffix or offset.