473,403 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Calculating hours

Don
How would I get a query to calculate hours?
if "Starttime" = 10:00AM
and
"Quittime" = 04:00PM
Thanks,
Don.............
Oct 21 '06 #1
2 1975
Don wrote:
How would I get a query to calculate hours?
if "Starttime" = 10:00AM
and
"Quittime" = 04:00PM
Thanks,
Don.............

t1 = #10:00 AM#
t2 = #4:00 PM#
? dateDiff("h",t1,t2)
6
Oct 21 '06 #2
"Don" <vz******@verizon.netwrote in news:Dsq_g.118$gZ2.14
@trndny07:
How would I get a query to calculate hours?
if "Starttime" = 10:00AM
and
"Quittime" = 04:00PM
Thanks,
Don.............
I'll assume that the two fields in question are of type
datetime.
If that assumption is wrong skip these instructions.

Just paste this into a field column of the lower part of the
query design grid.

HoursWorked: datediff("h",[starttime],[Quittime])

Note that this will return the time to the nerest hour.
For a timekeeping system, you need to go to minutes,
MinutesWorked: datediff("n",[starttime],[Quittime])

then show that as hh:mm using an user defined function such as

Public Function minutes2Duration(minutes As Long) As String
Dim hours As Long, mins As Integer
hours = minutes \ 60
mins = minutes Mod 60
minutes2Duration = Format(hours, "#0") _
& ":" & Format(mins, "00")
End Function
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Oct 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Hans Gruber | last post by:
Hi all, I have been struggling with a problem all day, I have been unable to come up with a working solution. I want to write a function which takes 2 unix timestamps and calculates the...
1
by: Shaun Thornburgh | last post by:
Hi, I have a table called Bookings which has two important columns; Booking_Start_Time and Booking_End_Time. These columns are both of type DATETIME. Given any day how can I calculate how many...
0
by: hlam | last post by:
Help - Calculating the total of a column in a data grid -- when data grid is part of Master-Detail set-up I have setup a Master-Detail form using Visual Studio.Net. A ListBox is the (Master)...
1
by: evilasukakitty | last post by:
I too am new to the whole C++ language, and I am an eager beaver and wish I could absorb it all instantly, but I can't. The first program I wrote (very simple) was easy enough, using your basic cin...
8
by: hmmtn | last post by:
I would appreciate any help on this one. Assignment is as follows: Develop a program that will determine the gross pay for each of several employees. The company pays "straight time" for the first...
6
by: richbneal | last post by:
I really like the site so far and this is my first post. I have looked through some of the archives with no luck. I have also read the posting guidelines and will do my best to be clear and accurate...
4
by: jnice814 | last post by:
I have created a frmTimesheet form where auditors will enter their hours for audits that they've worked on. I know how to build a very basic, no-frills database, and what I'm trying to accomplish...
4
realin
by: realin | last post by:
hi guys.. I have made a function which counts the numbers of days or hours or minutes from the current datetime to the give datetime.. but i am confused while displaying number of days along with...
25
by: Blaize | last post by:
Hi, I'm having an issue trying to calculate time. Its okay if the value does not exceed 24 hours otherwise I get a date and hours listed. For example, I have a loop which looks through a table...
4
by: Missionary2008 | last post by:
Thank you in advance for your help. I'm trying to calculate the Total Time in hours and minutes to complete a job. The way we are calculating it is by taking the Fee paid and dividing that by a...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.