In fact, Excel stores the datetime as number , so you need to explicitly specify the cell format in order to see the correct value.
You can use the TEXT function, but in any case you need to specify the format output line:
=TEXT(A1,"hh:mm:ss")
Another option is to write your own VBA function that can convert the cell value based on this format:
Public Function GetString(ByVal cell As Range) As String GetString = Format(cell, cell.NumberFormat) End Function
This will give you a result based on the format of the source cell
Andrey Gordeev
source share