Solved

Working with time function to determine actual time

Posted on 2013-01-29
7
182 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
  • 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 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

17 Experts available now in Live!

Get 1:1 Help Now