Search code examples
exceldatedatetimetimezoneiso8601

Parsing an ISO8601 date/time in Excel


How to parse ISO 8601 time date format in Excel?

I found this example1 but it won't work for me because my format does not have dashes between year-month-day.

In other words please help me convert this format 20170427T221520.900Z into UTC date in Excel.


Solution

  • Since Z:

    indicates that the time value is the time in Greenwich, England, or UTC time

    there is no need to adjust for time zones.

    Using an approach similar to the linked example in OP:

     =DATE(MID(A1,1,4),MID(A1,5,2),MID(A1,7,2))+TIMEVALUE(MID(A1,10,2)&":"&MID(A1,12,2)&":"&MID(A1,14,6))
    

    An alternative would be to parse the input fixed width appropriately with Text to Columns:

    Fixed width parsing

    and then assemble appropriately all the relevant pieces, say with:

    =CONCATENATE(C1,"/",B1,"/",A1)+CONCATENATE(D1,":",E1,":",F1)
    

    Reassembly

    Both of the above create a date/time index that may then be formatted to suit.