Date & Time Functions

Excel · Lesson 11 of 30 8 min read Updated

Dates are everywhere in office work: joining dates, invoice due dates, EMI schedules, attendance and leave. Excel handles them well once you know one secret: every date is really a number. With that in mind, adding 30 days to a date or counting working days becomes simple arithmetic.

In this lesson you will learn how dates and times are stored, build and take apart dates, calculate ages and service periods, add months, count working days with Indian holidays and six-day weeks, and work out the April to March financial year.

Dates are numbers

Excel stores a date as the number of days since 1 January 1900, which is day 1. So 30 October 2026 is stored as 46325. The date you see is just a number format applied to that value. Type a date, change the cell's format to General, and the serial number appears.

Times are stored as fractions of a day: 0.5 is 12:00 noon, 0.25 is 6:00 AM, and 46325.75 is 30 October 2026 at 6:00 PM.

Because dates are numbers, you can subtract them. With 15-Jun-2021 in C2 and 30-Oct-2026 in F1:

Excel formula
=F1-C2
Output
1963

That is the number of days between the two dates. If the result shows as a strange date instead, change the cell format to General or Number.

Today's date and building dates

FormulaReturnsNotes
=TODAY()Today's dateChanges every day when the file recalculates
=NOW()Today's date and the current timeAlso changes
=DATE(2026,10,30)30 October 2026Always year, month, day
=YEAR(F1)2026Also MONTH and DAY
=WEEKDAY(F1,2)5Monday = 1 ... Sunday = 7
=TEXT(F1,"dddd")Friday"mmm" gives Oct, "mmmm" gives October

TODAY() is perfect for "days remaining" columns, but it is wrong for records: a bill dated with TODAY() shows a new date tomorrow. For a fixed date, press Ctrl+; to type today's date as a value.

DATE is also smart about overflow: =DATE(2026,13,1) gives 1 January 2027, and =DATE(2026,11,0) gives the last day of October. This makes it useful inside other formulas.

The sample sheet

The examples below use an HR sheet from a small firm in Pune. To keep the answers fixed, today's date is typed into F1 as 30-Oct-2026. In a real sheet, F1 would hold =TODAY().

ABC
1NameDate of birthJoining date
2Meera15-Aug-199815-Jun-2021
3Farhan05-Jan-200101-Nov-2024
4Isha31-Dec-199501-Apr-2019

Age and service with DATEDIF

Subtracting and dividing by 365 gives a slightly wrong age because of leap years. DATEDIF counts complete years, months or days correctly:

Excel formula
=DATEDIF(B2, $F$1, "Y")
Output
Meera: 28
Farhan: 25
Isha: 30

The third argument sets the unit: "Y" for complete years, "M" for complete months, "D" for days. For years of service, use the joining date: =DATEDIF(C2,$F$1,"Y") gives 5 for Meera, and "M" gives 64 months.

Adding months: EDATE and EOMONTH

Adding 30 days is not the same as adding one month. EDATE adds whole months and handles short months correctly:

Excel formula
=EDATE(C3, 6)
Output
01-May-2025

Farhan joined on 1 November 2024, so his six-month probation ends on 1 May 2025. EDATE is also how you build an EMI schedule: the due date of instalment n is =EDATE(first_due_date, n-1). If a start date is 31 January, one month later is 28 February, not 3 March.

EOMONTH returns the last day of a month, a given number of months away. =EOMONTH(F1, 0) gives 31-Oct-2026 (this month's salary date), and =EOMONTH(F1, 1) gives 30-Nov-2026.

Both functions return serial numbers, so format the cells as dates.

Working days, holidays and six-day weeks

NETWORKDAYS counts working days between two dates, assuming Saturday and Sunday are off. A third argument takes a range of holiday dates. With 1-Oct-2026 in H1, 31-Oct-2026 in H2, and Gandhi Jayanti (2-Oct-2026) in H4:

Excel formula
=NETWORKDAYS(H1, H2, H4)
Output
21

October 2026 has 22 weekdays, and the holiday falls on a Friday, leaving 21.

Many Indian shops and offices work six days a week. NETWORKDAYS.INTL lets you choose the weekend. Weekend code 11 means "Sunday only":

Excel formula
=NETWORKDAYS.INTL(H1, H2, 11, H4)
Output
26

You can also give the weekend as a seven-character text of 0s and 1s, starting from Monday, where 1 means a day off: "0000001" is Sunday only, and "0000011" is Saturday and Sunday.

To find a date a number of working days ahead, use WORKDAY: =WORKDAY(F1, 10) returns 13-Nov-2026, ten working days after 30 October (ignoring holidays). WORKDAY.INTL accepts the same weekend codes.

The Indian financial year

The Indian financial year runs from 1 April to 31 March. A date from April onwards belongs to the financial year starting that calendar year; a date from January to March belongs to the one that started the year before. With a date in A2:

Excel formula
=IF(MONTH(A2)>=4, YEAR(A2), YEAR(A2)-1)

For 30-Oct-2026 this gives 2026. To show the usual label, put that formula in B2 and join the parts:

Excel formula
="FY " & B2 & "-" & RIGHT(B2+1, 2)
Output
FY 2026-27

The financial quarter (April to June is Q1) is =ROUNDUP((MOD(MONTH(A2)-4,12)+1)/3, 0), which returns 3 for October.

Working with times

Because times are fractions of a day, subtracting two times gives a fraction. Multiply by 24 to get hours. With 09:30 in B2 and 18:15 in C2:

Excel formula
=(C2-B2)*24
Output
8.75

For a night shift from 22:00 to 06:00, the plain subtraction is negative. MOD wraps it past midnight: =MOD(C2-B2, 1)*24 returns 8.

Common mistakes

  • Dates typed as text. "30.10.2026" with dots is usually stored as text, and date functions return #VALUE!. Use hyphens or slashes that match your settings, or DATE.
  • Age from dividing by 365. Leap years make it wrong near birthdays. Use DATEDIF.
  • Adding 30 for a month. Months have 28 to 31 days. Use EDATE.
  • TODAY() on bills and records. It changes every day. Use Ctrl+; for a fixed date.
  • A result that looks like a date when you wanted a number. Change the format to General.

Key points

  • A date is a serial number (1 = 1 January 1900) and a time is a fraction of a day.
  • Subtract dates to get days; use DATEDIF for complete years and months.
  • EDATE adds months, EOMONTH finds month ends, and DATE builds dates safely.
  • NETWORKDAYS and WORKDAY count working days; the .INTL versions handle six-day weeks.
  • The Indian financial year is IF(MONTH(d)>=4, YEAR(d), YEAR(d)-1).

Exercise

A bank loan of 12 monthly instalments has its first EMI due on 05-Nov-2026 (in B1). In A3:A14 put the instalment numbers 1 to 12. Write a formula in B3 to fill down that gives each due date, and a formula in C3 that shows the weekday name. Then find the financial year label of the last instalment.

Show solution
Excel formula
=EDATE($B$1, A3-1)
=TEXT(B3, "dddd")
Output
B3:  05-Nov-2026 (Thursday)
B4:  05-Dec-2026 (Saturday)
B14: 05-Oct-2027 (Tuesday)

$B$1 stays fixed while A3-1 grows from 0 to 11. The last due date, 5 October 2027, is after April, so its financial year starts in 2027: put =IF(MONTH(B14)>=4, YEAR(B14), YEAR(B14)-1) in D14 and ="FY " & D14 & "-" & RIGHT(D14+1, 2) in E14 to show FY 2027-28.

Quick Quiz

1. How does Excel store the date 30 October 2026?

2. Which function adds exactly three calendar months to a date?

3. A shop is closed only on Sundays. Which function counts its working days in a month?

4. What is the financial year of a bill dated 15-Feb-2027?

Learn Excel with a mentor

Free lessons get you started. Our Excel & Office Skills training adds real projects and code reviews from working developers.

  • Project-based learning
  • Mentor code reviews
  • Free counselling call