question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I want to store the following in my database: moment the some
kind of process begins and the moment that process ends, and than I
have to calculate duration in hours. Process can start one day(eg. Monday) and
end next day(Tuesday or even Wednesday). What format, input mask should I use? How can
I calculate duration?
Also, what's the difference between Date and DateSerial functions?

Thanx

alekm
 
Store the start date/time and end date/time as date/time values. Use the
DateDiff function to calculate the difference between the two:

DateDiff("h", StartDate, EndDate)

The Date function takes no arguments, and returns the current date. Since
you're dealing with both Date and Time, you'll probably want to use the Now
function. (There's also a Time function that returns just the current time)

The DateSerial function takes three arguments: Year, Month and Day (in that
order), and returns a date value corresponding to whatever the 3 arguments
specify. Note that DateSerial interprets its input: You can specify
DateSerial(2003, 13, 2), and it will be interpretted as 2 Jan, 2004.
(There's also a corresponding TimeSerial function that works with Hour,
Minute and Second)
 
Back
Top