If I have 5:32:43 (5 hours 32 Minutes and 43 Seconds) is there a function to turn this into decimal (5.5453)
Thanks
Printable View
If I have 5:32:43 (5 hours 32 Minutes and 43 Seconds) is there a function to turn this into decimal (5.5453)
Thanks
That just seems to put it in the format 5:32:43? Is there a way to make it change it to decimal?
.5453 is the decimal fraction equilivalent of :32:43?
Value will be 5.54527777777778Code:Value = CDbl(CDate("5:32:43")) * 24
yes it is
THank you CVMichael thats what I was looking for
Welcome...
Don't forget to mark the tread as Resolved from Thread Tools Menu
[Edit]
Ah... I was slow on that... you already did
Just a note:
The Date data type is actually stored as a double, so the previous you can even do as:
If you want to add a day (for example) to the date, you can do:Code:Value = #5:32:43# * 24
To add a todays date to a time value:Code:Tomorow = Date + 1
To find out how many days are between 2 dates:Code:TodaysDateAndTime = Date + #5:32:43#
Etc.Code:Days = #2/1/2006# - #2/20/2006#
So, since it's stored as a double, you can do mathematical calculations with it...
where
1 is one day
1 / 24 = 4.16666666666667E-02 is one hour
1 / 24 / 60 = 6.94444444444444E-04 is one minute
and finally
1 / 24 / 60 / 60 = 1.15740740740741E-05 is one second
So if you want to add one second to a time: #5:32:43#
You do
I know, I know... more than you asked for... sorry...Code:Debug.Print #5:32:43# + 1.15740740740741E-05
Returns: 5:32:44 AM
But it's good to know