DATE()

Syntax. DATE(year,month,day)

Definition. This function returns the serial number for a date indicated by the year, month, and day arguments.

Arguments

Background. When calculating dates, you sometimes need to work with the component parts and might then want to return the value as a normal date. The DATE() function converts the parts of a date back into a (numeric) date expression that you can use in other date calculations. Excel interprets the year argument according to the date system being used by your computer. Excel for Windows uses the 1900 date system, and Excel for Mac uses the 1904 date system.

The following applies to the 1900 date system:

The following applies to the 1904 date system:

For both systems, if the month is greater than 12, the number of months is added to the first month of the given year, and if the day is greater than the number of days in the given month, this number is added to the first day of the month.

See Also

For more information about saving dates in Excel, see the section titled The Excel Date System in Chapter 2.

Example. You might need to calculate the first and the last day of the month for a given date in an accounting application. The formula

=DATE(YEAR("07/23/2008"),MONTH("07/23/2008"),1)

returns 07/01/2008 as the first day of the month. The formula generates the number of the year and month from the given date with the day number 1. The formula

=DATE(YEAR("07/23/2008"),MONTH("07/23/2008")+1,1)-1

returns 07/31/2008 as the last day of the month. The formula generates the number of the year and the month increased by 1 (the following month) from the given date with the day number 1. If you subtract one day, you get the last day of the previous month.

Here are more examples:

See Also

TIME(), DATEVALUE(), TODAY(), YEAR(), MONTH(), DAY(), TIMEVALUE()