Convert hours & minutes to minutes (1 Viewer)

skwilliams

Registered User.
Local time
Today, 08:02
Joined
Jan 18, 2002
Messages
516
How can I convert hours and minutes to minutes as an Integer?

For example, convert 2:15 to 135.

Any help is greatly appreciated.
 

DJkarl

Registered User.
Local time
Today, 07:02
Joined
Mar 16, 2007
Messages
1,028
Number of hours * 60 then add the minutes...

(2*60) + 15 = 135
 

skwilliams

Registered User.
Local time
Today, 08:02
Joined
Jan 18, 2002
Messages
516
The problem is the original format of this field is hh:nn but the conversion is to a Integer field.

For example:

2:15 converted to 135.
 

DJkarl

Registered User.
Local time
Today, 07:02
Joined
Mar 16, 2007
Messages
1,028
Well if the field is a text field (I'm guessing it is) then you would need to take the number left of the semi-colon ":" and multiply it by 60, then add the number right of the semi-colon to that. Check out the Left, Right and Instr functions to do this; if this result is going to be in the same table you would need to add a new column and place the results there, if it is in a new table then you can just append / update.
 

skwilliams

Registered User.
Local time
Today, 08:02
Joined
Jan 18, 2002
Messages
516
I found that I could do it like this.

Minutes: Hour(TimeDiff)*60+Minutes(TimeDiff)


Thanks for the help!
 

confuse

Registered User.
Local time
Today, 05:02
Joined
Jul 17, 2008
Messages
49
I found that I could do it like this.

Minutes: Hour(TimeDiff)*60+Minutes(TimeDiff)


Thanks for the help!

hi Skwilliams can you share to me how you solve this problem???

Hope to hear from you...

Thanks
 

skwilliams

Registered User.
Local time
Today, 08:02
Joined
Jan 18, 2002
Messages
516
Perhaps you could clarify what you are asking.

The formula for this solution is "Minutes: Hour(TimeDiff)*60+Minutes(TimeDiff)".
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 07:02
Joined
Feb 28, 2001
Messages
27,148
Or...

I = CLng( 24*60 * CDate( "your time string here" ) )

or

I = CLng( 24 * 60 * Cdate( [ your time-string field here ] ) )

(Spaces were added to protect my poor old eyes... and everyone else's)
 

confuse

Registered User.
Local time
Today, 05:02
Joined
Jul 17, 2008
Messages
49
Or...

I = CLng( 24*60 * CDate( "your time string here" ) )

or

I = CLng( 24 * 60 * Cdate( [ your time-string field here ] ) )

(Spaces were added to protect my poor old eyes... and everyone else's)


thanks for the help the dock man, i got it......:eek:
 

Users who are viewing this thread

Top Bottom