Excel Formula for Converting ISO-8601 Timestamp to Excel Date

When KDXplore or KDSmart use a Timestamp for a scored Trait value the timestamp is recorded in ISO-8601 format. Using this format means that you can correctly compare data collected in different timezones.

Unfortunately Microsoft Excel does not automatically recognize this format. However, using the formula below, you can easily convert the date/time string in ISO-8601 format into an Excel date/time value and, by using an appropriate cell format (e.g. yyyy-mm-dd hh:mm:ss) render this in a more useful form.

The formula is:

	=DATEVALUE(LEFT(A1,10))
	+ TIMEVALUE(MID(A1,12,8))
	+ IF("Z"=MID(A1,20,LEN(A1)-19),0,(INT(MID(A1,20,LEN(A1)-19)/100)*60+MOD(MID(A1,20,LEN(A1)-19),100))/1440)
      
If you wish to know what the formula is doing, the explanation is below. The formula above is split across three lines to faciliate the following explanation.

Excel's internal date time format is a "real" number where the part before the decimal point is the number of days and the portion after the decimal point is the "fraction" of a day.