Numbers Exercises

Date Functions in Numbers: DATE, DATEDIF, WEEKDAY, EDATE

Last updated:

Short answer: DATE builds a date from year, month and day. YEAR, MONTH and DAY take parts back out, DATEDIF gives the difference between two dates, and WEEKDAY, EDATE and EOMONTH help with weekdays and months.

Creating a date with DATE

DATE turns three separate numbers into a date: year, month and day. YEAR, MONTH and DAY take a part back out. Here the date is 25 December 2026.

=YEAR(DATE(2026,12,25))
Result: 2026
=MONTH(DATE(2026,12,25))
Result: 12
=DAY(DATE(2026,12,25))
Result: 25

The difference between two dates with DATEDIF

DATEDIF gives the difference between two dates in days ("D"), whole months ("M") or whole years ("Y"). Here from 1 January to 25 December 2026.

=DATEDIF(DATE(2026,1,1),DATE(2026,12,25),"D")
Result: 358
=DATEDIF(DATE(2026,1,1),DATE(2026,12,25),"M")
Result: 11

The day of the week with WEEKDAY

WEEKDAY returns the number of the day in the week. By default Sunday is 1 and Saturday is 7, so a Friday gives 6.

=WEEKDAY(DATE(2026,12,25))
Result: 6

Shifting months with EDATE and EOMONTH

EDATE shifts a date by a number of months. EOMONTH gives the last day of a month; with 0 you stay in the same month.

=MONTH(EDATE(DATE(2026,11,15),3))
Result: 2
=DAY(EOMONTH(DATE(2026,2,10),0))
Result: 28

Times with TIME and HOUR

TIME builds a time from separate numbers: hour, minute and second. HOUR takes the hour back out.

=HOUR(TIME(14,30,0))
Result: 14

Frequently asked questions

How do I calculate the number of days between two dates?

Use DATEDIF with "D", for example DATEDIF(start, end, "D").

What number does Sunday have in WEEKDAY?

By default Sunday is 1 and Saturday is 7.

How do I find the last day of a month?

Use EOMONTH with 0 months and take DAY of it, for example DAY(EOMONTH(date, 0)).

Functions in this article

Practise it yourself

Type the formula yourself in a real exercise and see right away if your answer is correct. The first exercises are free.

Start practising