Re: Subtracting date and time values

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Tom Ellison (tellison_at_jcdoyle.com)
Date: 03/24/04


Date: Wed, 24 Mar 2004 00:24:43 -0600

Dear Calvin:

How about using Datediff to get the difference in minutes, and divide
by 60, or in seconds and divide by 3600? Then you'd have hours with a
decimal point. Taking the integer and fraction parts of this, you'd
have hours and fractions of an hour. Multiply the fraction by 60 and
get minutes, with decimals again.

Should not be hard to do.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts

On Tue, 23 Mar 2004 22:08:03 -0800, "Calvin Shane"
<anonymous@discussions.microsoft.com> wrote:

>My client is using Access to provide dates and times on
>equipment failures (using Date and Time opened as one
>field, and date and time closed as one field (date and
>time separated by a space, in the following format:
>
>Date closed field is mm/dd/yyyy hh:mm AM/PM
>Date opened field is same as above.
>
>Instead of using Excel (currently), he wants Access to
>produce Mean Time Between Failures (MTBF), which is the
>date/time closed of the next record, minus date/time
>opened of the previous record (record -1), and produce
>result in the line of previous record, and so on. MTBF
>will not be produced for the 1st record, but will
>thereafter. I've learned about using "Datediff", but
>currently have no PC with Access to test it. With these
>formats, is it possible using "Datediff" to produce a
>result in hours/minutes or hours.hundredth hours (like
>1.2 hours)?



Relevant Pages

  • Re: Subtracting date and time values
    ... Taking the integer and fraction parts of ... >Tom Ellison ... >>equipment failures (using Date and Time opened as one ... >>produce Mean Time Between Failures (MTBF), ...
    (microsoft.public.access.queries)
  • Re: behaviour vs. data first
    ... whole, fraction, add, subtract, multiply, divide ... Real conforms-to Integer // C1 ... U1 will fail with a type error, ...
    (comp.object)
  • Re: Letter to the Editor: The truth of ID is self-evident
    ... The numerator and denominator of a fraction can be any ... And yes, 7 does divide 22. ...
    (talk.origins)
  • Re: Assembly Language - Mathematics WITHOUT maths coprocessor
    ... So I think my answer of 12.04119983 is a little more correct, as 40 bits can hold as many values as 12 decimal digits, plus just a little bit more. ... multiply by 2 ^ precision, you shift it left by precision. ... Convert fraction part to binary as if it were an integer. ... Divide fraction part by what step 4 effectively multiplied it by. ...
    (alt.lang.asm)
  • Re: scaling coefficients for c
    ... do I code a fraction in binary form for use in c code or asm language? ... they call their Q or IQ formats, which are fixed point representations. ... Speaking generally, and keeping your example numbers in mind, it is ... from decimal is to multiply and divide by ...
    (comp.dsp)