Hi,
I have created a macro to convert TIMX value. It converts values accurate to minutes, there will be some variance in seconds value.
Open a new Microsoft Excel workbook, place a button named “ConvertTimestamp” on sheet1, open the macro editor and paste the below code and save the workbook. Now place the values you want to convert on sheet2 first column and click button “ConvertTimestamp” to convert.
"Private Sub ConvertTimestamp_Click()
Dim nattime As Double
Dim contime As String
Dim avgdays_peryear As Double
Dim Tenthofsec_year As Double
Dim no_of_leapyear As Double
Dim no_normal_year As Double
Dim tot_no_days As Double
Dim tot_tenthofsec As Double
Dim rem_tenthofsec As Double
Dim temp_hold_tenthofsec As Double
Dim cal_year As Integer
Dim cal_days As Integer
Dim cal_Hours As Integer
Dim cal_min As Integer
Dim cal_sec As Integer
Dim cal_date As String
Dim i As Long
avgdays_peryear = 365.241807353158
Tenthofsec_year = 365.241807353158 * 24 * 60 * 60 * 10
i = 1
nattime = Sheet2.Cells(i, 1)
Do Until nattime = 0
cal_year = WorksheetFunction.Quotient(nattime, Tenthofsec_year)
no_of_leapyear = Int((cal_year / 4) - (cal_year / 100) + (cal_year / 400) - 1)
If ((cal_year Mod 4) = 0 And (cal_year Mod 100) <> 0) Or ((cal_year Mod 4) = 0 And (cal_year Mod 100) = 0 And (cal_year Mod 400) = 0) Then
no_of_leapyear = no_of_leapyear - 1
End If
no_normal_year = cal_year - no_of_leapyear
tot_tenthofsec = ((no_normal_year * 365) + (no_of_leapyear * 366)) * (864000)
rem_tenthofsec = nattime - tot_tenthofsec
temp_hold_tenthofsec = rem_tenthofsec / 864000
cal_days = Int(rem_tenthofsec / 864000)
temp_hold_tenthofsec = temp_hold_tenthofsec - cal_days
cal_Hours = Int(temp_hold_tenthofsec * 24)
rem_tenthofsec = (temp_hold_tenthofsec * 24) - cal_Hours
cal_min = Int(rem_tenthofsec * 60)
temp_hold_tenthofsec = (rem_tenthofsec * 60) - cal_min
cal_sec = Int(temp_hold_tenthofsec * 60)
cal_date = Format(DateSerial(cal_year, 1, cal_days), “YYYY-MM-DD”)
contime = cal_date & “-” & Format(cal_Hours, “0#”) & “.” & Format(cal_min, “0#”) & “.” & Format(cal_sec, “0#”) & “.000000”
Sheet2.Cells(i, 1) = contime
Sheet1.Cells(i, 1) = Int(nattime)
Sheet1.Cells(i, 2) = contime
i = i + 1
nattime = Sheet2.Cells(i, 1)
Loop
MsgBox “Conversion Completed”
End Sub "
PS: Not tested completely. Testing with multiple TIMX values of different years required before production use. To ensure accuracy.