[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Working with time function to determine actual time

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

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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…
Suggested Courses

825 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