Time/Date Queries

  • Thread starter Harold via AccessMonster.com
  • Start date
H

Harold via AccessMonster.com

Hi, Im trying to make a query that deturmines the differance between two
date/time fields. The fields are DateOS, TimeOS, DateIS, TimeIS. I've
separated the time date fields in order to make entry easier. I will add
these together before finding the differance, ie. [DateOS] + [TimeOS] and
[DateIS] + [TimeIS]. Maybe something like this: Datediff ([DateOS] + [TimeOS])
([DateIS] + [TimeIS]). Also, after I find the differance between the dates I
need to sort by that differance, largest differance in time to smallest.

Thanks,
Harold
 
A

Allen Browne

Try:
Datediff ("s", [DateOS] + [TimeOS], [DateIS] + [TimeIS])

That should return the nubmer of seconds difference between the 2 values, so
you can sort by them.

It may not work correctly for dates before 1900.
 
D

Duane Hookom

Apparently you have already discovered the DateDiff() function. Check Help
for the exact syntax.
 
Top