Field Guide

Excel date functions: TODAY, DATE, DATEDIF, WEEKDAY and the working set

Updated

Excel’s everyday date work comes down to a small working set of formulas: =TODAY() puts the current date in a cell, =DATE(2026,8,15) builds a date from a year, a month and a day, =DATEDIF(A2,B2,"D") counts the days between two dates, and =TEXT(A2,"dddd") turns a date into its weekday name. Around those four sit DAY, MONTH and YEAR for pulling a date apart, WEEKDAY for numbering the day of the week, EOMONTH for month-end deadlines, and NETWORKDAYS for working days.

All of them trade in the same raw material: an Excel date is a serial number, a count of days in which January 1, 1900 is stored as 1, and the cell’s format only decides how that number is displayed. That mechanic, and everything about changing how a date looks, is covered in Excel date formats; this page is about the functions that read and produce the numbers.

How do I put today’s date in a cell?

fx
=TODAY()

TODAY takes no arguments and returns the serial number of the current date. If the cell’s format was General, Excel switches it to Date, so what you see is a date, not the raw count. The point of the function is that it moves: Microsoft describes it as the way to show the current date on a worksheet regardless of when you open the workbook. Open the file next Tuesday and the cell says next Tuesday.

=NOW() is the same idea including the time: it returns the current date and time in one serial number, with the time stored in the decimal part (0.5 is 12:00 noon). Per Microsoft, its result changes only when the worksheet is calculated or when a macro containing it runs; it does not update continuously. If either function seems stuck, the settings that control recalculation are the first suspect; Excel formula not calculating walks through them. In Excel for Windows the setting lives under File > Options > Formulas, under Calculation options.

Because dates are numbers, arithmetic on TODAY just works: Microsoft’s own examples include =TODAY()+5 for the date five days from now.

Build a date from its parts with DATE

D2
fx
=DATE(A2,B2,C2)
A B C D
1 Year Month Day Date
2 2026 8 15 15 Aug 2026
DATE assembles the year in A2, the month in B2 and the day in C2 into one real date: D2 holds August 15, 2026, displayed through whatever date format the cell carries.

DATE(year, month, day) exists for exactly this: three separate values, often what an import hands you as separate columns, combined into a date Excel can calculate with. Microsoft’s page even documents the pattern for a text import in the YYYYMMDD shape: =DATE(LEFT(C2,4),MID(C2,5,2),RIGHT(C2,2)) slices the string and rebuilds it as a date.

DATE’s arguments have two documented surprises:

Pull the day, month or year out of a date

C2
fx
=MONTH(A2)
A B C D
1 Date Day Month Year
2 15 Aug 2026 15 8 2026
B2 holds =DAY(A2), C2 holds =MONTH(A2), D2 holds =YEAR(A2): the date in A2 comes apart into 15, 8 and 2026.

DAY, MONTH and YEAR each take one date and return one integer: the day from 1 to 31, the month from 1 (January) to 12 (December), the year from 1900 to 9999. The results are numbers, never names; August comes back as 8. They combine naturally with DATE, and Microsoft’s DATE page shows the classic move, an anniversary shifted whole years forward: =DATE(YEAR(C2)+5,MONTH(C2),DAY(C2)). The same shape with TODAY gives Microsoft’s age formula, =YEAR(TODAY())-1963, a person’s age as of this year’s birthday.

How do I get the day of the week from a date?

Two formulas answer this, and they return different things. For the day’s name, TEXT renders the date with a weekday format code; for a number you can calculate or sort on, WEEKDAY returns an integer.

C2
fx
=WEEKDAY(A2)
A B C
1 Date Day name Day number
2 15 Aug 2026 Saturday 7
August 15, 2026 falls on a Saturday. B2 holds =TEXT(A2,"dddd") and returns the text Saturday; C2 holds =WEEKDAY(A2) and returns 7 under the default numbering of 1 (Sunday) through 7 (Saturday).

WEEKDAY’s optional second argument picks the numbering scheme: with the default (1 or omitted) the week runs 1 (Sunday) through 7 (Saturday), with return type 2 it runs 1 (Monday) through 7 (Sunday), which would make the Saturday above a 6, and further documented types shift the start day around the week. The name route works for months too: =TEXT(A2,"mmmm") returns August and "mmm" returns Aug. The format codes and their traps live with the TEXT function; the one thing to carry from there is that TEXT output is text and stops calculating.

There is also a no-formula route when the underlying date should stay put and only the display should change. Microsoft’s page on showing dates as days of the week walks it: select the cells, open the Number Format list on the Home tab, choose More Number Formats, and on the Number tab under Category choose Custom, then type dddd (or ddd for the short form) in the Type box. The cell still holds the date; only the display changes to the weekday name.

DATEDIF: the difference between two dates

DATEDIF is the odd one out: its own documentation opens with a warning. “Excel provides the DATEDIF function in order to support older workbooks from Lotus 1-2-3.” Microsoft’s page adds that it may calculate incorrect results in some scenarios, so treat it as a legacy convenience rather than a precision instrument. It is still the shortest route to a date gap in the unit you want:

C2
fx
=DATEDIF(A2,B2,"D")
A B C D
1 Start End Days Months
2 1 Feb 2026 15 Aug 2026 195 6
C2 counts 195 days between 1 Feb 2026 and 15 Aug 2026. D2 holds =DATEDIF(A2,B2,"M") and returns 6, the complete months in the same period.

The third argument is a unit code: "D" for days in the period, "M" for complete months, "Y" for complete years, and three partial units that ignore pieces of the dates, "YM" (months, ignoring days and years), "YD" (days, ignoring the years) and "MD" (days, ignoring months and years). That last one carries an explicit caution: Microsoft recommends against "MD", because it “may result in a negative number, a zero, or an inaccurate result”. A #NUM! error means the start date is later than the end date.

Microsoft notes the function is useful for calculating ages, and also points out the simpler route for the most common case: for plain days between two dates, no function is needed at all. =B2-A2 returns 195 for the dates above, because subtracting one stored day count from another is ordinary arithmetic.

EOMONTH: deadlines that land on month end

=EOMONTH(A2,1)
A2 holds an invoice date of 15 Aug 2026. The 1 moves one month forward, and EOMONTH returns the last day of that month: 30 Sep 2026. A negative months value walks backwards to a past month end.

EOMONTH returns the serial number of the last day of the month a given number of months away from the start date, which is why Microsoft’s page frames it around maturity dates and due dates that fall on month end. Payment terms like “end of the month following the invoice” become one formula. A start date that is not a valid date returns a #NUM! error, and so does a months shift that yields an invalid date.

NETWORKDAYS: working days between two dates

D2
fx
=NETWORKDAYS(A2,B2,C2)
A B C D
1 Start End Holiday Working days
2 1 Sep 2026 30 Sep 2026 7 Sep 2026 21
September 2026 has 22 weekdays. With the Monday 7 September holiday listed in C2, NETWORKDAYS returns 21 working days in D2.

NETWORKDAYS returns the number of whole working days between the start and end dates: weekends are excluded, and so is anything in the optional holidays argument, which accepts a range of cells holding the dates to skip. Microsoft’s framing is employee benefits that accrue per day worked, but the same call counts out project timelines and delivery windows. If any argument is not a valid date, the function returns a #VALUE! error. Weekends here mean Saturday and Sunday; for a working week with different weekend days, Microsoft points at NETWORKDAYS.INTL, which takes the weekend pattern as a parameter.

Why is my date formula not working?

The failure that runs through this whole family is a date that is not a date. Microsoft’s function pages repeat the same warning almost verbatim on DAY, MONTH, YEAR, WEEKDAY, EOMONTH and NETWORKDAYS: enter dates with the DATE function or through other formulas, because a date typed in as text can cause problems. A text entry that merely looks like a date has no serial number behind it, so it will not sort as a date, and functions built for serial numbers can misread or reject it. Spotting one, and the DATEVALUE fix, are covered in Excel date formats.

The short version

Frequently asked questions

How do I put today's date in a cell in Excel?
Enter =TODAY(). It returns the current date, and because it recalculates with the worksheet, the cell always shows the date the workbook is opened or recalculated on, not the date you typed the formula. If a General cell held the formula, Excel switches the cell's format to Date for you. For the current date and time in one cell, use =NOW(); its result changes only when the worksheet is calculated or a macro containing it runs, not continuously.
How do I get the day of the week from a date in Excel?
There are three ways. =TEXT(A2,"dddd") returns the day name as text, like Saturday ("ddd" gives Sat). =WEEKDAY(A2) returns a number, by default 1 for Sunday through 7 for Saturday, with other numbering schemes available through its second argument. Or leave the value alone and change only the display: Microsoft's guidance is to open the Number Format list on the Home tab, choose More Number Formats, and enter dddd as a Custom format code.
What does DATEDIF do in Excel?
DATEDIF calculates the number of days, months or years between two dates: =DATEDIF(A2,B2,"D") returns days, "M" complete months, "Y" complete years, and "YM", "YD" and "MD" compare while ignoring parts of the dates. Microsoft documents it as provided to support older workbooks from Lotus 1-2-3, warns it may calculate incorrect results in certain scenarios, and recommends against the "MD" unit. If the start date is later than the end date, the result is a #NUM! error.
How do I calculate the number of days between two dates in Excel?
Subtract them: =B2-A2 returns the count of days, because Excel stores dates as numbers. =DATEDIF(A2,B2,"D") returns the same count. If you want only working days, =NETWORKDAYS(A2,B2) counts whole working days between the two dates, excluding weekends, and an optional third argument excludes a list of holidays too.
How do I get the month name from a date in Excel?
Use TEXT: =TEXT(A2,"mmmm") returns the full name, like August, and =TEXT(A2,"mmm") the short form, like Aug. The MONTH function is the wrong tool for names: it returns the month as a number from 1 (January) to 12 (December), never the word. TEXT results are text, right for labels and headings, not for arithmetic.
How do I add or subtract days from a date in Excel?
Plain arithmetic works, because a date is a stored number. Microsoft's guidance is to simply add or subtract the number of days, so =A2+30 returns the date 30 days after the one in A2, and Microsoft's own example =TODAY()+5 returns the date five days from today. Adding months is different, since months vary in length; for the specific case of month-end deadlines, =EOMONTH(A2,1) returns the last day of the month after the date in A2.

Catch the errors before they ship

Reviewing a change to a model? Compare the two versions in your browser and see every changed cell, formula, and value. It's free, and nothing leaves your computer.