Solved

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

Posted on 2006-11-13
7
1,428 Views
Last Modified: 2008-01-09
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
Comment
Question by:bjennings
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 44

Expert Comment

by:GRayL
ID: 17932664
=Hours(totaltime)*60 +Minutes(totaltime) + IIf(Seconds(totaltime)>29,1,0)
0
 
LVL 44

Expert Comment

by:GRayL
ID: 17932671
In this case I condsidered the seconds portion of totaltime and rounded it up to 1 it 30 seconds or more.

0
 
LVL 9

Expert Comment

by:dancebert
ID: 17932694
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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 16

Expert Comment

by:Rick_Rickards
ID: 17933140
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
 
LVL 44

Accepted Solution

by:
GRayL earned 250 total points
ID: 17933693
Sorry, remove the s from each of my functions:


=Hour(totaltime)*60 +Minute(totaltime) + IIf(Second(totaltime)>29,1,0)
0
 

Author Comment

by:bjennings
ID: 17938564
Thank you so much everyone!!!  GRayl was the easiest solution!
0
 
LVL 44

Expert Comment

by:GRayL
ID: 17939796
Thanks, glad I could help
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question