I have coded the conversion for hours minutes and seconds already, but when every time I run this code the year changes to 1899 and the days to 30. There must be a small change that could solve this problem but I cant figure out how. I know that vba sets years automatically to 1899 and days to 30 but how can this problem be avoided? Thank you very much!
Option Explicit
Sub Conversion()
Dim inpt As Double
Dim time As Double
inpt = Application.InputBox("Give me your time in seconds: ")
time = inpt / (CDbl(24) * 60 * 60)
MsgBox "Your calculated time is:" & Chr(10) & Year(time) & " years" & Chr(10) & Day(time) & " days" & Chr(10) & Hour(time) & " hours" & Chr(10) & Minute(time) & " minutes" & Chr(10) & Second(time) & " seconds"
End Sub