help Convert hrs to min 
Author Message
 help Convert hrs to min

I have constructed a data base that caculates times.  IE: [Time
in]-1-[Time out]=[Total time], this is all in the short time format.
How can I convert these time values to minuetes?  This clock works on a
24hour time clock.  The date and the time will be in the following
format:

Date:           12-Jan-98
Time in         21:00
Time out        01:00 (on 13-Jan-98)
Total time      04:00

Conversion to min.      ?



Mon, 24 Jul 2000 03:00:00 GMT  
 help Convert hrs to min

Try:
[Total time] = iif([Time out]<[Timein], 24-[Timein]+[Time out],
[Timein]-1-[Time out])
or something like this
Best regards,
___________
Alex Dybenko
Point Limited

Home Page: http://www.geocities.com/SiliconValley/Heights/5091/
Moscow MS Access User Group, chairman
http://www.arimsoft.ru/msaccess


Quote:
>I have constructed a data base that caculates times.  IE: [Time
>in]-1-[Time out]=[Total time], this is all in the short time format.
>How can I convert these time values to minuetes?  This clock works on a
>24hour time clock.  The date and the time will be in the following
>format:

>Date: 12-Jan-98
>Time in 21:00
>Time out 01:00 (on 13-Jan-98)
>Total time 04:00

>Conversion to min. ?



Mon, 24 Jul 2000 03:00:00 GMT  
 help Convert hrs to min

Assuming the elapsed times are always less than 24 hours then the following
will work

datediff("n",#00:00#,ElapsedTime)

so for 04:00

datediff("n",#00:00#,#04:00#) = 240


Quote:
>I have constructed a data base that caculates times.  IE: [Time
>in]-1-[Time out]=[Total time], this is all in the short time format.
>How can I convert these time values to minuetes?  This clock works on a
>24hour time clock.  The date and the time will be in the following
>format:

>Date: 12-Jan-98
>Time in 21:00
>Time out 01:00 (on 13-Jan-98)
>Total time 04:00

>Conversion to min. ?



Mon, 24 Jul 2000 03:00:00 GMT  
 help Convert hrs to min

Access stores Date/Time values as a 64-bit floating point number in which
the integer portion represents the number of days before (negative values)
or after (positive values) 12/30/1899 (who knows why!). The fractional
portion of the stored value is the portion of a day passed since midnight.

Date/Time values ALWAYS contain a date and a time regardless of the display
format (Short Date, Long Date, Short Time, etc.) specified. If a Date is
input with no specific time then time "zero" (midnight) is stored--i.e. an
entry of 01/01/1900 will be stored as 2.0...

Similarly a time input with no specific date is stored with day "zero"
(12/30/1899)--i.e. entry of 6:00 am is stored as 0.25...

Therefore it is important in applications intended to calculate elapsed
time to store both the date and the time (as a single value) for the
starting and ending events. When allowing user input of date and time in
separate textboxes, via masked inputs, it is wise to add the date and the
time and store the result as a single value. This can be most safely
accomplished by the following:

        [StartTime] = Fix(tbxStartDate) + ((tbxStartTime) - Fix(tbxStartTime))

This may look like overkill, however it is the only way to be 100% certain
that any time component inadvertantly entered in the date textbox, and any
date component inadvertantly entered in the time textbox are stripped
before the two are combined.

The calculated value can be stored in your table during the '.BeforeUpdate'
event for your form, store an ending time in the same manner.

Now, to calculate the elapsed time just subtract [StartTime] from [EndTime]
to get a floating point number representing the number of days which have
elapsed. Since a day is 24 hours, or 1440 minutes, or 86400 seconds; just
multiply the calculated value time 1440 to get minutes.

Example:


        Elapsed = 3.020833333 - 2.875 = 0.145833333 days
                 = 0.145833333 days * 1440 = 210 minutes
                 = 210 minutes / 60 = 3.5 hours

This function will return a string in the format hh:mm:ss.s from input of a
Date type value.

Public Function fncDate2HrMnSec(dt As Date) As String
    Dim ts As String
    Dim ti As Long
    ti = Fix(dt) * 24 + Fix((dt - Fix(dt)) * 24)
    ts = Format(ti, "#,##0:")
    dt = dt - ti / 24
    ti = Fix(dt * 1440)
    ts = ts & Format(ti, "00:")
    dt = dt - ti / 1440
    ts = ts & Format(dt * 86400, "00.0")
    fncDate2HrMnSec = ts
End Function

Hope this helps...

-cliff-



Quote:
> I have constructed a data base that caculates times.  IE: [Time
> in]-1-[Time out]=[Total time], this is all in the short time format.
> How can I convert these time values to minuetes?  This clock works on a
> 24hour time clock.  The date and the time will be in the following
> format:

> Date:              12-Jan-98
> Time in            21:00
> Time out   01:00 (on 13-Jan-98)
> Total time 04:00

> Conversion to min. ?



Sun, 30 Jul 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. hrs to min conver

2. Help with adding times over 24 hrs

3. Change actual work to days instead of hrs?

4. Message for Justin@Online Ref Hrs & Minutes

5. Time function - how to add 3 hrs

6. Date range/tot hrs program

7. testing for 24 or 12 hrs system's time

8. Finding Max or Min Values - HELP!!!!

9. Help Min., Max, Close.

10. Help - General network error after 5 min

11. Newbie needs help with MIN, MAX and AVERAGE functions

12. Min to systray..HELP?

 

 
Powered by phpBB® Forum Software