New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Understanding dates as serial numbers

From: Access 2010: Queries in Depth

Video: Understanding dates as serial numbers

You would think that storing dates in your database will be a fairly straightforward routine operation. On the surface, to you and I it is. But behind-the-scenes Access does a lot of work to make sure that your date-specific records are kept in order. Understanding how Access stores, retrieves, and formats date and time-based data can really help down the road. Access uses a serial number system to keep track of dates and times. Let's open up the Chapter 5 custom group and we'll take a look at our Dates table. Here we have a table listing of dates. If I run a query called DateSerial number, I have those dates listed down and I have a function that converts the date into the serial number representation.

Understanding dates as serial numbers

You would think that storing dates in your database will be a fairly straightforward routine operation. On the surface, to you and I it is. But behind-the-scenes Access does a lot of work to make sure that your date-specific records are kept in order. Understanding how Access stores, retrieves, and formats date and time-based data can really help down the road. Access uses a serial number system to keep track of dates and times. Let's open up the Chapter 5 custom group and we'll take a look at our Dates table. Here we have a table listing of dates. If I run a query called DateSerial number, I have those dates listed down and I have a function that converts the date into the serial number representation.

You'll see that dates are represented by a whole number and they decrease as you go back in time, until you get to December 30th, 1899, which is represented by the serial number 0. Anything before that date gets negative; anything after that date is positive. Now the same thing applies to times. Let's run another query, this TimeSerial number query. You'll see that times are represented by fractions of a day and that makes sense. Starting at 12 midnight, at 0.0, at 12 noon which is halfway through the day is 0.5, three-quarters of the way through the day at 6 p.m. is 0.75, and if we get to 11:59 and 59 seconds, that's represented by the serial number 0.9999.

Now in these fractions we also have 0 and we already saw that 'd0 means that this time is applying to December 30th, 1899. Now you probably never try and extract a date from a single time field but if we look at our dates again we'll realize that the whole number is actually saying 0.0. So in Access' world, everything that happens on a specific date happens at 12 midnight. Let's see how these serial numbers affect working with comparison operators and dates and time data. When you have a field that stores date-only data, the relationship to each other is pretty straightforward.

May 11th is less than May 12th, May 12th is equal to May 12th and May 13th is obviously greater than May 12th. But if you include dates and times in the same records, for instance I have May 11th at 11:59:59, things get a little bit weird. The relationship for May 12th here is obviously less than May 12th. 1 second later at 12 midnight, Access says this is equal to May 12th and 1 second after midnight on May 12, Access thinks this is after May 12th or greater than.

So when using comparison operators with dates and times, it makes a difference if your date and time fields are together or discrete. Understanding the serial nature of how Access stores dates can clear up some evaluations down the road. It's always a good idea to understand what's going on behind-the-scenes in order to make better sense of how we can work with that on the front end.

Show transcript

This video is part of

Image for Access 2010: Queries in Depth
Access 2010: Queries in Depth

46 video lessons · 13241 viewers

Adam Wilbert
Author

 
Expand all | Collapse all
  1. 9m 9s
    1. Welcome
      1m 10s
    2. Using the exercise files
      41s
    3. Introducing the database
      4m 29s
    4. Previewing the course
      2m 49s
  2. 17m 17s
    1. Understanding queries
      3m 31s
    2. Following naming conventions and best practices
      2m 56s
    3. Using the Query Wizard
      5m 21s
    4. Exploring the design interface
      5m 29s
  3. 26m 39s
    1. Defining criteria
      5m 40s
    2. Understanding comparison operators
      3m 19s
    3. Defining the column headers
      2m 49s
    4. Exploring the property sheet
      7m 32s
    5. Printing query results
      2m 41s
    6. Working with joins
      4m 38s
  4. 14m 14s
    1. Understanding parameter queries
      4m 27s
    2. Obtaining parameters from forms
      5m 17s
    3. Creating a combo box
      4m 30s
  5. 23m 24s
    1. Understanding the Totals field
      5m 31s
    2. Creating aggregate calculations
      3m 31s
    3. Exploring the Expression Builder interface
      4m 28s
    4. Using mathematical operators
      5m 46s
    5. Applying text functions
      4m 8s
  6. 24m 23s
    1. Understanding dates as serial numbers
      2m 42s
    2. Specifying a range of dates or times
      3m 47s
    3. Formatting dates
      4m 31s
    4. Using other Date/Time functions
      3m 47s
    5. Defining today's date
      2m 41s
    6. Calculating time intervals
      6m 55s
  7. 20m 9s
    1. Introducing the conditional IIf function
      2m 57s
    2. Creating an IIf function
      7m 31s
    3. Nesting IIf functions
      4m 57s
    4. Using the Switch function
      4m 44s
  8. 20m 41s
    1. Understanding the reporting tool
      2m 13s
    2. Building the form
      6m 57s
    3. Building the query
      5m 4s
    4. Building the report
      3m 30s
    5. Finalizing the reporting tool
      2m 57s
  9. 25m 37s
    1. Finding duplicate records
      2m 17s
    2. Identifying unmatched records
      2m 29s
    3. Creating crosstab results
      2m 57s
    4. Creating backups
      1m 29s
    5. Creating update queries
      3m 22s
    6. Making, deleting, and appending records
      5m 36s
    7. Uniting tables
      3m 16s
    8. Embedding SQL code in queries
      4m 11s
  10. 1m 0s
    1. Next Steps
      1m 0s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold

Are you sure you want to delete this note?

No

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.