|
-
Jun 18th, 2006, 02:36 PM
#1
Thread Starter
Addicted Member
Time Conversion
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
-
Jun 18th, 2006, 09:33 PM
#2
Re: Time Conversion
Something along these line:
VB Code:
MsgBox DateDiff("s", "00:00:00", "23:45:06")
Yeilds: 85506 (Seconds sine midnight).
Last edited by Bruce Fox; Jun 18th, 2006 at 09:36 PM.
-
Jun 20th, 2006, 08:05 AM
#3
Frenzied Member
Re: Time Conversion
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.
Code:
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
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
Jun 21st, 2006, 07:13 AM
#4
Re: Time Conversion
Code:
=(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:
Code:
?cdbl(cdate("23:45:06"))*24*60
(same as webtests! - sorry!)
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|