You are here:About>Computing & Technology>Databases> Microsoft Access> Access Function Library> Microsoft Access Function Library: DateDiff()
About.comDatabases
Newsletters & RSSEmail to a friendSubmit to Digg

Microsoft Access Function Library: DateDiff()

From Mike Chapple,
Your Guide to Databases.
FREE Newsletter. Sign Up Now!
Function: DateDiff()

Purpose: The DateDiff() function returns the difference between two dates.

Usage: DateDiff(interval, date1, date2)

Interval may be set to:
  • yyyy for year
  • q for quarter
  • m for month
  • y for day of year
  • d for day
  • w for weekday
  • ww for week
  • h for hour
  • n for minute
  • s for second


Returns: Number of intervals between date1 and date2.

Examples and Special Cases
DateDiff("yyyy", "6-Nov-2006", "7-Nov-2006") returns 0
DateDiff("yyyy", "31-Dec-2006", "1-Jan-2007") returns 1
DateDiff("d", "6-Nov-2006", "8-Nov-2006") returns 2
 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.