472,958 Members | 1,768 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

time functions - total greater than 24 hours

I'm summing up time spent on jobs over a week, some of these jobs last
greater than 24 hours and when access sums these up it appears that it
starts again at 00:00 once it gets past 23:59.

Is it possible to display the time taken in hours and mins past the 24 hour
clock? i.e 34:23?
Jun 8 '06 #1
3 15913
Stephen Chaplin wrote:
I'm summing up time spent on jobs over a week, some of these jobs last
greater than 24 hours and when access sums these up it appears that it
starts again at 00:00 once it gets past 23:59.

Is it possible to display the time taken in hours and mins past the
24 hour clock? i.e 34:23?


The DateTime DataType in most all databases is intended for storing a point in
time, not a duration.

Two things lead to the confusion you are having. People use the written
expression 4:30 to mean both the time four-thirty and the duration four hours
and thirty minutes. In a database it always means the time four-thirty.

Many database engines store DateTimes under the covers as numbers so if you do
mathematical calculations on them they *appear* to work as durations. However
as you have seen, once you cross a 24 hour boundary the date portion changes and
the time portion wraps around.

The proper way to deal with durations is to store the smallest time interval
precision you care about as a number. A table tracking labor hours would
typically store this as the total number of minutes. After all summing has been
accomplished on the numeric value you can then use mathematical expressions to
convert this to hours and minutes for display purposes.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jun 8 '06 #2
"Stephen Chaplin" <sc**@york.ac.uk> wrote in message
news:e6**********@pump1.york.ac.uk...
I'm summing up time spent on jobs over a week, some of these jobs last
greater than 24 hours and when access sums these up it appears that it
starts again at 00:00 once it gets past 23:59.

Is it possible to display the time taken in hours and mins past the 24 hour clock? i.e 34:23?


This is kind of cumbersome but I have used the following calculated fields
in a query to first determine the elapsed minutes between two date/time
intervals and then to convert the minutes to an hours:minutes result:

Table Fields: Date1 (Date/Time), Date2 (Date/Time)

First Calculated Field:
ElapsedMins: Abs(DateDiff("n",[Date2],[Date1]))

Second Calculated Field:
Duration: [ElapsedMins]\60 & Format([ElapsedMins] Mod 60,"\:00")

Example:
Date1 - 4/4/2006 6:34:00 PM
Date2 - 4/3/2006 1:32:00 PM

ElapsedMins = 1742

Duration = 29:02 (29 hours, 2 minutes)
Jun 8 '06 #3
"Stephen Chaplin" <sc**@york.ac.uk> wrote in
news:e6**********@pump1.york.ac.uk:
I'm summing up time spent on jobs over a week, some of these
jobs last greater than 24 hours and when access sums these up
it appears that it starts again at 00:00 once it gets past
23:59.

Is it possible to display the time taken in hours and mins
past the 24 hour clock? i.e 34:23?

When you use the datediff() function to obtain the interval
between two times (start and stop) the result is a long integer.
Using a date format to display it will often, as in your case,
show garbage.

with datediff(), you can choose seconds, minutes, hours, days,
weeks, months or years. use the one that gives you the precision
you need,

Just write a custom function that converts the long integer for
minutes to a usable format. I posted an example called Sec2Dur()
a couple of years ago, which can retrieved by searching Google
Groups for that name. As written it will convert seconds into
the format hhhhhhhhhh:mm:ss

--
Bob Quintal

PA is y I've altered my email address.

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

Jun 8 '06 #4

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

Similar topics

0
by: Rahmi Acar | last post by:
Can any one redirect me to the place where i can find the stuff i need? Im by the way adding net time protocol so it will syncronise by it's own intergated watch. This is a start stopp application...
3
by: iceColdFire | last post by:
Hi, Last night I was trying to work on a project requiring lots of timer controls...I needed good ANSI based API's for milliseonds and other stuff... However , google on time funcitons in c++,...
2
by: meltedown | last post by:
This represents 2 fields in a mysql database => 2005-08-22 18:04:41 => 2005-08-22 18:05:08 I want to find out the difference between these 2 times. I don't have access to mysql's DATEDIFF...
1
by: Consigliare | last post by:
Hi, I am trying to compare two time fields to get the difference in hours as a whole number. I have tried the following: Format((Format('<ENDTIME>','hh.nn') -...
2
by: J M | last post by:
I rebooted a network device just few minutes ago and getting device-up-time value 3191. How do I convert a time elapsed in days hours minutes and seconds for above value? Example: This device...
5
by: simondsm | last post by:
I have a video tape library that we use at work here in a MS-Access database. When originally desgined, we never thought ot convert the time on the fly into total seconds, but instead, we stored...
2
by: lucius | last post by:
I have a List of DateTimes that look like this {1753-01-01 16:00:00} {1753-01-01 22:00:00} And I would like to do something in my WinForm/CommandLine app that does MyMethod() every day at...
3
by: Generic Usenet Account | last post by:
Hi, Is there any way to make time-of-day adjustments for daylight savings using only standard time functions? We have a program that executes daily at a fixed time of day. After daylight...
0
blackgoat
by: blackgoat | last post by:
Hi! I have some data stored in text form which appears in the following format: mon_jan_01_16:00:33_t23.96-d568 A number of such entries are present in my file. I need to pick out(thru...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.