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()
From the course: Access 2016: Queries
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
Dates as serial numbers4m 52s
-
(Locked)
Select a range of dates or times3m 10s
-
(Locked)
Date and time functions4m 42s
-
(Locked)
Format dates5m 9s
-
(Locked)
Sort dates chronologically5m 26s
-
(Locked)
Obtain today's date2m 9s
-
(Locked)
Calculate elapsed time with DateDiff()4m 43s
-
(Locked)
Calculate time intervals with DateAdd()4m
-
(Locked)
Challenge: Expand order details33s
-
(Locked)
Solution: Expand order details5m 15s
-
-
-
-
-
-