Difference in minutes between two time fields

G

Guest

I'm trying to calculate the difference in minutes between two fields and
place the result in a 3rd field. The first two fields are data type
"date/time" for the format is Medium date. The 3rd field is data type
"number" with a field size of "long integer"
 
R

Rob Parker

You can calculate the difference in minutes with:
DateDiff("n",[StartDateTime],[EndDateTime])

However, you should NOT store this value, since you can calculate it
whenever you need it. Here's the standard warning from MVP John Vinson,
which appears regularly in this newsgroup:

"Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact."

HTH,

Rob
 
G

Guest

thanks VERY much

Rob Parker said:
You can calculate the difference in minutes with:
DateDiff("n",[StartDateTime],[EndDateTime])

However, you should NOT store this value, since you can calculate it
whenever you need it. Here's the standard warning from MVP John Vinson,
which appears regularly in this newsgroup:

"Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact."

HTH,

Rob


Ed Crawford said:
I'm trying to calculate the difference in minutes between two fields and
place the result in a 3rd field. The first two fields are data type
"date/time" for the format is Medium date. The 3rd field is data type
"number" with a field size of "long integer"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top