Summing Time

  • Thread starter Thread starter lorna walsh
  • Start date Start date
L

lorna walsh

Hi,

I've read many posts but cannot seem to come up with a formula or query for
the following:
I have two times in and out formated as date/time.
In the query I used DATEDIFF to get the difference in hours mins and
seconds.
I can get it to see say 1:45 but when you try to get it as a numeric field
to add the time it reads 1:75.
Once you use datediff to format it is no longer a number.
Does anyone know how I would get a field with 1:45 numeric.

Thanks,Lorna
 
Your 1:75 should not have a colon but a decimal - 1.75 for one and three
quarters of an hour. Then you can add.

Post your formula for suggestions.
 
TimeSpt1: Format(DateDiff("s",[intime],[outtime])\3600,"0\:") &
Format((DateDiff("s",[intime],[outtime]) Mod 3600)\60,"00")
produces a time format which is left justified and not numeric. The numeric
field is timesecs/60 which produces 1.75 but appears with the other format
would show 1:45
 
Try this --
TimeSpt1: CDbl(Format(DateDiff("s",[intime],[outtime])\3600,"0\.") &
Format((DateDiff("s",[intime],[outtime]) Mod 3600)\60,"00"))

You should be able to add these results.

lorna walsh said:
TimeSpt1: Format(DateDiff("s",[intime],[outtime])\3600,"0\:") &
Format((DateDiff("s",[intime],[outtime]) Mod 3600)\60,"00")
produces a time format which is left justified and not numeric. The numeric
field is timesecs/60 which produces 1.75 but appears with the other format
would show 1:45

KARL DEWEY said:
Your 1:75 should not have a colon but a decimal - 1.75 for one and three
quarters of an hour. Then you can add.

Post your formula for suggestions.
 
Worked perfectly. thank you so much I've been working on that for days, was
not aware of those conversions.

thanks again!!!!
KARL DEWEY said:
Try this --
TimeSpt1: CDbl(Format(DateDiff("s",[intime],[outtime])\3600,"0\.") &
Format((DateDiff("s",[intime],[outtime]) Mod 3600)\60,"00"))

You should be able to add these results.

lorna walsh said:
TimeSpt1: Format(DateDiff("s",[intime],[outtime])\3600,"0\:") &
Format((DateDiff("s",[intime],[outtime]) Mod 3600)\60,"00")
produces a time format which is left justified and not numeric. The
numeric
field is timesecs/60 which produces 1.75 but appears with the other
format
would show 1:45

KARL DEWEY said:
Your 1:75 should not have a colon but a decimal - 1.75 for one and
three
quarters of an hour. Then you can add.

Post your formula for suggestions.

:

Hi,

I've read many posts but cannot seem to come up with a formula or
query
for
the following:
I have two times in and out formated as date/time.
In the query I used DATEDIFF to get the difference in hours mins and
seconds.
I can get it to see say 1:45 but when you try to get it as a numeric
field
to add the time it reads 1:75.
Once you use datediff to format it is no longer a number.
Does anyone know how I would get a field with 1:45 numeric.

Thanks,Lorna
 
Back
Top