Time calculation

  • Thread starter Thread starter Greg W
  • Start date Start date
G

Greg W

I am trying to calculate an ending time by adding an
elapsed time (in seconds) field to a constant start time
of 5:00 am.

The following works fine with smaller elapsed time totals
but won't work with 9.5 hours (34200 seconds).

time serial(5,0,0,+[elapsed time])

I don't know the elapsed time cutoff where this stops
working.


Any ideas?
 
The way dates are stored in a database is:
they are stored as a DOUBLE, starting from the beginning of last century,
ie, 01 Jan 1900

so try
a = CDbl(Now)
and see what that gives you. The whole part is (the date) the number of
days past 01 Jan 1900 as you can see , just over 100 years.

the decimal part is the time ie, .5 is noon

you might want to convert the dates to a double and do the calculations like
that.
 
The arguments of TimeSerial() function are Integers so
they are limited to 32K (2 ^ 15).

BTW, the expression you posted is incorrect. TimeSerial
has 3 arguments, NOT 4 as you posted.

HTH
Van T. Dinh
MVP (Access)
 
The parameters for the TimeSerial function are defined as integers, which
means their value can only be between -32,768 and 32,767. Try

DateAdd("s", [elapsed time], TimeSerial(5,0,0))
 
Back
Top