Solved

convert minutes to HH:MM

Posted on 2013-01-31
3
543 Views
Last Modified: 2013-02-04
I am trying to gather the total elapsed time when a user travels.  My code SORT OF works, but instead of return HH:MM i am getting HH:MM:SS AM/PM.

pda, arrvtime, minutes, totalmin dimmed as intergers


Private Sub cmdCCT_Click()
' used to determine if traveler traveled on a non workday

    If frmWD.Value = 1 Then
        mydir = -480
    Else
        mydir = 0
    End If
   
pda = 180 ' 3 hours before departure on flight
arrvtime = txtATAROD.Value * 60 'determines time from airport to site
minutes = DateDiff("n", [txtTDOTDY], [txtTAOTDY]) 'time of flight departs - time flight arrives

totalmin = arrvtime + minutes + pda + mydir ' total elapsed time in minutes

totalCT = Format(totalmin \ 60, "0") & ":" & Format(totalmin Mod 60, "00")


txtCTHADOD.SetFocus
txtCTHADOD.Text = totalCT

End Sub

As an example flight departs 08:00
                           flight arrives  18:00
                             elapsed time 10 hours or 600 minutes(datediff function)
                           takes 90 minutes to arrive at job site
                           180(pda
so totalmin = 180(pda)+90(arrvtime)+minutes or totalmin = 870.

totalct dimmed as date (tried interger, long, double but kept getting type mismatch error)

when I use this:  totalCT = Format(totalmin \ 60, "0") & ":" & Format(totalmin Mod 60, "00")  the result is 2:30:00 pm  what I need is to show the total elapsed Hours and Minutes and not 2:30:00 pm.
0
Comment
Question by:sptech
  • 2
3 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 38838780
For some reason, nobody ever implements elapsed time, only time-of-day.  Elapsed time is apparently a do-it-yourself function.
0
 

Accepted Solution

by:
sptech earned 0 total points
ID: 38838784
I changed the dimmed variable totalct from date to variant and low and behold I am getting the correct display.
0
 

Author Closing Comment

by:sptech
ID: 38850522
No points, just found my own solution.
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now