Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old May 6th, 2002, 11:40 PM
Ronald Ronald is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Virginia
Posts: 1 Ronald User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Calculate time worked.

I wonder if someone could help me find a way of calculating the time worked by an employee using military time…

I have a form with three (3) text boxes and a command button.
The first text box “TxtStartTime”, will contain a start time entered by the user
in military time, for ex: 0800, 1300, 2330, etc.

The second text box “TxtEndTime”, will contain an end time also entered by the
user in military time.

When the user clicks on the command button “CmdTotal”, I would like to display
the total work time in the third text box “TxtTotal”.

If the user enters a start time of 0800 and an end time of 1300, then the total time should
read 5.00 to indicate that the time worked is 5 hours and zero minutes.

If the user enters a start time of 1300 and an end time of 1730, then the total time should
read 4.50 to indicate that the time worked is 4 and one half hour. It should not read 4.30.

Also, if the user enters a start time of 2300 (11:00 pm) and an end time of 0700 (7:00 am), then the total time should read 8:00 hours worked.

Some more examples are:-
0900 to 1315 = 4.25 hours worked.
2200 to 0320 = 5.33 hours worked.
1700 to 1945 = 2.75 hours worked.
1330 to 2005 = 6.58 hours worked.

I think these fractions of the hour have something to do with dividing 100 by 60.
I do have the correct formula in Excel 97 and it works well. I could send a sample of the Excel spread sheet if that would help someone.

Any help would be greatly appreciated,
Ron

Reply With Quote
  #2  
Old May 11th, 2002, 02:07 PM
Atrus's Avatar
Atrus Atrus is offline
yet another member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 262 Atrus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Hi!

Hmmm, this is really easy. Why don't you separate hours from minutes (simply by digits) go
EndTimeHours minus StartTimeHours
as well as
EndTimeMinutes minus StartTimeMinutes.

First, however, make sure that EndTime* is greater then StartTime* and if not, add 60 to EndTimeMinutes respectively 24 to EntTimeHours to make them greater (in case a job takes past midnight, for example).

Then print
Code:
print "Worked " + StartTimeHours + ":" + StartTimeMinutes + " hours...";


I bet there is a perl module on www.cpan.org for this kind of task. The task should come easy, just the 24ary representation and 60ary representation mixed look difficult.

Regards,

Atrus.

BTW: Why is this a database question, after all?
__________________
Webmaster - Stefan Meier KG TABAKWAREN - Pfeifen, Premium-Zigarren, ... (_Ger)

Reply With Quote
  #3  
Old March 7th, 2008, 12:41 PM
wbrooks9926 wbrooks9926 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 1 wbrooks9926 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m
Reputation Power: 0
wbrooks9926

Quote:
Originally Posted by Ronald
I wonder if someone could help me find a way of calculating the time worked by an employee using military time…

I have a form with three (3) text boxes and a command button.
The first text box “TxtStartTime”, will contain a start time entered by the user
in military time, for ex: 0800, 1300, 2330, etc.

The second text box “TxtEndTime”, will contain an end time also entered by the
user in military time.

When the user clicks on the command button “CmdTotal”, I would like to display
the total work time in the third text box “TxtTotal”.

If the user enters a start time of 0800 and an end time of 1300, then the total time should
read 5.00 to indicate that the time worked is 5 hours and zero minutes.

If the user enters a start time of 1300 and an end time of 1730, then the total time should
read 4.50 to indicate that the time worked is 4 and one half hour. It should not read 4.30.

Also, if the user enters a start time of 2300 (11:00 pm) and an end time of 0700 (7:00 am), then the total time should read 8:00 hours worked.

Some more examples are:-
0900 to 1315 = 4.25 hours worked.
2200 to 0320 = 5.33 hours worked.
1700 to 1945 = 2.75 hours worked.
1330 to 2005 = 6.58 hours worked.

I think these fractions of the hour have something to do with dividing 100 by 60.
I do have the correct formula in Excel 97 and it works well. I could send a sample of the Excel spread sheet if that would help someone.

Any help would be greatly appreciated,
Ron


I would like to check out the spread sheet.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Calculate time worked.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway