Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Working with time function to determine actual time

Posted on 2013-01-29
7
Medium Priority
?
230 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 48

Expert Comment

by:Dale Fye
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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 

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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

618 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