[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1433
  • Last Modified:

Access 2003 How to convert hours - minutes - seconds to minutes

Hello,

I import a text file that give me time formated h:mm:ss which is good.  I can see all calls for a day and have a total of say 5:19:23.  What I want to do is to convert h:mm:ss to only minutes?

How do I covert it to minutes??

Thanks

Bill
0
bjennings
Asked:
bjennings
1 Solution
 
GRayLCommented:
=Hours(totaltime)*60 +Minutes(totaltime) + IIf(Seconds(totaltime)>29,1,0)
0
 
GRayLCommented:
In this case I condsidered the seconds portion of totaltime and rounded it up to 1 it 30 seconds or more.

0
 
dancebertCommented:
You didn't say what you wanted to do with the seconds.  This trucates.

Public Function HHMMSS_To_Minutes(ByVal sTime As String) As Integer
    Dim col1stColon As Integer
    col1stColon = InStr(sTime, ":")
   
    Dim iHours As Integer
    iHours = Left(sTime, col1stColon - 1)
    Dim iMins As Integer
    iMins = Mid(sTime, col1stColon + 1, 2)
   
    ' ignores seconds
    HHMMSS_To_Minutes = (iHours * 60) + iMins
End Function
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
Rick_RickardsCommented:
Sub ConvertTimeToMinutes()
    Dim tim As Date
    tim = #1:05:30 AM#
    Debug.Print tim * 1440
End Sub

If you want to round the result encapsulate the last line with the round function like this...

Debug.Print Round(tim * 1440,2)

In any case the short answer is take your date/time variable and multiply it by 1440.  The result will be the number of minutes that that date/time variable contains.  

Be aware, that trying this against a date like today's date will result in a very large number.  I presume that you're trying to deal with much smaller numbers (difference between two date & times but if not you may need to decide how many days in the date portion of the field you want to include.


0
 
GRayLCommented:
Sorry, remove the s from each of my functions:


=Hour(totaltime)*60 +Minute(totaltime) + IIf(Second(totaltime)>29,1,0)
0
 
bjenningsAuthor Commented:
Thank you so much everyone!!!  GRayl was the easiest solution!
0
 
GRayLCommented:
Thanks, glad I could help
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now