Solved

Working with time function to determine actual time

Posted on 2013-01-29
7
205 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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, when working with VBA, learn some techniques for writing readable and easily maintained code.

803 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