From the course: Access 2016: Queries

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Calculate elapsed time with DateDiff()

Calculate elapsed time with DateDiff()

From the course: Access 2016: Queries

Start my 1-month free trial

Calculate elapsed time with DateDiff()

- [Voiceover] Now that we know how to tell Access to return today's date and the current time, we can use that information to help obtain query results that are relative to today. We have two different functions that return slightly different results depending on the type of question that we're trying to ask. The first one I want to take a look at is a function called DateDiff. Let's a construct a new query in design view to take a look at it. I'm going to build this off our employees table. I'll close the show table window and we'll add in the employee ID and their hire date. In the next column over, let's suggest that I want to find how many days ago they were hired. Well, one way that I can do this, we've already seen, is with some simple subtraction. I can type in the reference to the hire date field, just in square brackets, and then I can subtract today's date, which we can get with the date function. Just type in the open parenthesis followed immediately by a closing…

Contents