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

Microsoft Access Function Library: DatePart()

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

Purpose: The DatePart() function returns the requested piece of a date.

Usage: DatePart(interval, date)

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: Interval part of date.

Examples and Special Cases
DatePart("yyyy", "6-Nov-2006") returns 2006
DatePart("m", "31-Dec-2006") returns 12
DatePart("d", "6-Nov-2006") returns vbMonday (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.