Solved

Working with time function to determine actual time

Posted on 2013-01-29
7
215 Views
Last Modified: 2013-02-04
My company doesn't pay overtime, but does give comptime.  when a user travels on a non-workday they are given comptime for the travel portion of their day.  As an example:  
User travels on Sunday 2/3/2012 leaving from Germany and going to the home office in Washington DC.  The company gives 3 hours comptime before boarding the flight plus the length of the flight plus the time to get to the hotel or office.  If I take the time of departure say 11:30am and time of arrival 14:30pm comptime would be approx 7 hours (3 pre-departure, 3 based on time of departure and time of arrival, and 1 for taxi to hotel).  when in fact the flight is 9 hours long so actual comptime earned is 13 hours.

1) how do I do this?
0
Comment
Question by:sptech
[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
  • 5
7 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 38830421
Manually , I think.

If you go through the process of how you calculate the time and consider all the information you need to know if you are to calculate an accurate elapsed time, then you would have to incorporate all that information into a computer-based calculation.

So you need to know at least the time zones of the start point and end point - so your computer program would have to have some way of working this out for all possible start points and destinations.

If you only have a few possible locations then maybe you can build a table of locations and timezones but given that different countries have different periods for daylight saving time you have to have some way of handling this as well.

I don't know if there is a web service that might allow you to enter locations and local times and work out elapsed time, but it would be worth spending some time on google trying to find one.
0
 

Author Comment

by:sptech
ID: 38830505
actually I will know the timezone the traveler departs in.  I will know the direction of travel (e.g. east or west) and I have a timezone map.  so in the example above traveling from Germany to Washington DC. DC is six time zones away so departure time is say 0900 and arrival time is 1200 (noon) 3 hours plus 6 (for time zones) = 9 hours.
if my traveler is traveling east towards say turkey it is four hours ahead (+) so the inverse works in this example:  departs 0900, arrives 1500:  15-9=6, 6-4 (time zone changes) = 2 hours (actual flight time).

why I can do this math by hand, I really need to do this inside the application.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38830803
To do it inside the application, you would have to either input the timezones, or have a table which lists all possible departure/destination points and their time zones, and then enter the departure and destination cities.  You will also need to keep track of when daylight savings time starts/ends for each departure/destination points, as that will affect your calculations as well.

If all you are concerned with is locations where your company generally travels, this is not a big deal, but if it is for all travel, and that travel might involve destinations other than where you have an office, it could become daunting.
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:sptech
ID: 38830848
Yes it is.  I have figured out a possible solution and will post after I have tested out my idea.
0
 

Author Comment

by:sptech
ID: 38831048
I can now get the total minutes, but I keep running into an issue converting the  total minutes to HH:MM.  Any suggestions?

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

the variable totalmin is "long" in case that makes any difference.

I am getting a "type mismatch" error...UGH
0
 

Accepted Solution

by:
sptech earned 0 total points
ID: 38838606
I solved the issue with converting total minutes to hh:nn.  I had the variable dimensioned incorrectly

totalct as long

should have been

totalct as DATE
0
 

Author Closing Comment

by:sptech
ID: 38850520
I found that my variable was dimmed incorrectly.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

726 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