Click to See Complete Forum and Search --> : Time Conversion
Dastard
Jun 18th, 2006, 02:36 PM
Hi
well i want to calculate the number of minutes present in this time ( 23:45:06 )
this is time is in one cell .. i need a formula to put in another cell so that i can get the total number of minutes
Regards
Bruce Fox
Jun 18th, 2006, 09:33 PM
Something along these line:
MsgBox DateDiff("s", "00:00:00", "23:45:06")
Yeilds: 85506 (Seconds sine midnight).
Webtest
Jun 20th, 2006, 08:05 AM
Here is a step-by-step process to help you understand what you are trying to do ... convert a Date/Time value to a floating point number:
daysInteger.dayFraction
If daysInteger is 0, then the dayFraction * 24 = Hours and dayFraction * 24 * 60 = Minutes.Option Explicit
Sub Macro1()
Dim aTime As Date
Dim myHours As Double
Dim myMinutes As Double
'Initialize a Date/Time value
aTime = "23.49.22"
'Convert to Hours and Minutes
myHours = CDbl(aTime) * 24# ' 24# = 24.0
myMinutes = myHours * 60# ' 60# = 60.0
'Here are the results
MsgBox myHours & " " & myMinutes
End Sub
Ecniv
Jun 21st, 2006, 07:13 AM
=(HOUR(B4)*60)+MINUTE(B4)+(SECOND(B4)/60)
B4 holding the time.
Wasn't a coding question - sounds more like a classroom question - using normal functions.
Code:
?cdbl(cdate("23:45:06"))*24*60
(same as webtests! - :) sorry!)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.