How I get date and time into the table

  • Thread starter Thread starter Fred Wilson
  • Start date Start date
F

Fred Wilson

Hello all,

I have a table which among other information has an event actual start
time and end time.

The issue:
Events may run across days such as 20 JUN 05 13:00 to 21 JUN 05 06:30
To make DateDiff("h" EvtStart, EvtEnd) work I believe I need the date
and time.

I personally think it is pain to type the date/time group as it is above
and infinitely hard to trap entry errors.

Any ideas?
 
To get the time from the system when an event starts (or finishes) use the
Now() function at each event, then calculate the difference
 
Fred Wilson said:
Hello all,

I have a table which among other information has an event actual start
time and end time.

The issue:
Events may run across days such as 20 JUN 05 13:00 to 21 JUN 05 06:30
To make DateDiff("h" EvtStart, EvtEnd) work I believe I need the date
and time.

I personally think it is pain to type the date/time group as it is
above and infinitely hard to trap entry errors.

Any ideas?

In addition to what jl5000 said about using the Now() function, bear in
mind that DateDiff("h", EvtStart, EvtEnd) returns the number of hour
*boundaries* between EvtStart and EvtEnd. For example,

?DateDiff("h" #11:59AM#, #12:00PM#)
1

.... even though there's only one minute's difference between them. If
that's not the kind of result you want, you'd better use an expression
like

DateDiff("n", EvtStart, EvtEnd) / 60

to calculate hours, instead.
 
Okay, thanks for the advice on the divide by 60 thing.

My issue is that the time may go across a calendar day. The start and
end times are entered after the fact from a written log. So if I
understand datediff correctly, I need to get the date in with the time.
However, the same event may happen several times in one give date. Type
the date and the time several times is prone to errors.

Thanks,
Fred
 
Frederick Wilson said:
Okay, thanks for the advice on the divide by 60 thing.

My issue is that the time may go across a calendar day. The start and
end times are entered after the fact from a written log. So if I
understand datediff correctly, I need to get the date in with the
time. However, the same event may happen several times in one give
date. Type the date and the time several times is prone to errors.

You're aware, I trust, that you can enter the date in any of several
formats. For example, if you enter "6/24/05", that will be interpreted
the same as if you'd entered "June 24, 2005". Note that the
interpretation of "6/12/05" depends on your computer's regional date
format settings -- for some that will be interpreted as June 12, while
for others it will be understood as December 6th.

You may not be aware the the Ctrl+; (Control+Semicolon) key combination
enters the current date into a field, while the Ctrol+: (Control+Colon,
or Control+Shift+Semicolon on most keyboards) enters the current time.

You could also set up code for a text box's DblClick event, such that
double-clicking on it sets the value of the text box to Now().

Beyond those thoughts, I don't know what else you might want.
 
Back
Top