﻿ DATE function

# DATE function

This article describes the formula syntax and usage of the DATE function in Microsoft Excel.

## Description

The DATE function returns the sequential serial number that represents a particular date. For example, the formula

=DATE(2008,7,8)

returns 39637, the serial number that represents 7/8/2008.

Note   If the cell format was General before the function was entered, the result is formatted as a date instead of a number. If you want to view the serial number, or if you want to change the formatting of the date, select a number format in the Number group of the Home tab.

The DATE function is most useful in situations where the year, month, and day are supplied by formulas or cell references. For example, you might have a worksheet that contains dates in a format that Excel does not recognize, such as YYYYMMDD. You can use the DATE function in conjunction with other functions to convert the dates to a serial number that Excel recognizes. See the spreadsheet in the Example section of this article for more information.

## Syntax

DATE(year,month,day)

The DATE function syntax has the following arguments:

• Year    Required. The value of the year argument can include one to four digits. Excel interprets the year argument according to the date system your computer is using. By default, Microsoft Excel for Windows uses the 1900 date system.

We recommend using four digits for the year argument to prevent unwanted results. For example, "07" could mean "1907" or "2007." Four digit years prevent confusion.

• If year is between 0 (zero) and 1899 (inclusive), Excel adds that value to 1900 to calculate the year. For example, DATE(108,1,2) returns January 2, 2008 (1900+108).

• If year is between 1900 and 9999 (inclusive), Excel uses that value as the year. For example, DATE(2008,1,2) returns January 2, 2008.

• If year is less than 0 or is 10000 or greater, Excel returns the #NUM! error value.

• Month    Required. A positive or negative integer representing the month of the year from 1 to 12 (January to December).

• If month is greater than 12, month adds that number of months to the first month in the year specified. For example, DATE(2008,14,2) returns the serial number representing February 2, 2009.

• If month is less than 1, month subtracts the magnitude of that number of months, plus 1, from the first month in the year specified. For example, DATE(2008,-3,2) returns the serial number representing September 2, 2007.

• Day    Required. A positive or negative integer representing the day of the month from 1 to 31.

• If day is greater than the number of days in the month specified, day adds that number of days to the first day in the month. For example, DATE(2008,1,35) returns the serial number representing February 4, 2008.

• If day is less than 1, day subtracts the magnitude that number of days, plus one, from the first day of the month specified. For example, DATE(2008,1,-15) returns the serial number representing December 16, 2007.

Note   Excel stores dates as sequential serial numbers so that they can be used in calculations. January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900.

## Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

 Year Month Day 2011 1 1 Data 20111125 Formula Description Result =DATE(A2,B2,C2) Serial date for the date derived by using cells A2, B2, and C2 as the arguments for the DATE function. 40544 =DATE(YEAR(TODAY()),12,31) Serial date for the last day of the current year. 41274 =DATE(LEFT(A4,4),MID(A4,5,2), RIGHT(A4,2)) A formula that converts the text string in A4 (20111125) representing a date in a "YYYYMMDD" format to a date. 11/25/2011

Applies To: Excel 2013, Excel 2007, Excel 2010, Excel Starter, Excel Online, Excel 2016 for Mac

﻿