Imagine you are managing student records in a school in Ibadan. You have a spreadsheet showing students' registration dates, examination dates, payment dates, and graduation dates.
You may want to know how many days are left before an examination, which month a student registered, or how many days a customer took to pay for a product.
Microsoft Excel provides date and time functions that help you calculate, organise, and analyse information involving dates and time.
By the end of this module, you should be able to:
Excel can recognise dates and times as values that you can calculate with.
For example, you can subtract one date from another to find the number of days between them. You can also calculate how many hours an employee has worked.
Examples of dates and times include:
Important: Excel must recognise a value as a date or time before date and time calculations will work correctly. Text that only looks like a date may not calculate properly.
The TODAY function displays the current date according to your computer's date settings.
=TODAY()
The function does not need any information inside its brackets.
Enter this formula in cell A2:
=TODAY()
Excel displays the current date. For example, if the current date is 27 November 2026, the result will show that date.
The date updates automatically when Excel recalculates the worksheet on a later day.
Uses of TODAY include:
The NOW function displays the current date and time.
=NOW()
Enter the formula in any empty cell. Excel will display the current date and time.
For example, the result may look like this: 27/11/2026 10:30 AM.
The exact result depends on your computer's clock and date settings. Like TODAY, NOW updates when Excel recalculates.
Sometimes you have a complete date but only need a particular part of it. Excel provides three functions that can extract the day, month, or year.
DAY extracts the day number from a date.
Syntax:
=DAY(serial_number)
Suppose cell A2 contains the date 27/11/2026. Enter:
=DAY(A2)
Result: 27
MONTH extracts the month number from a date.
Syntax:
=MONTH(serial_number)
Using the same date, enter:
=MONTH(A2)
Result: 11
November is the eleventh month of the year.
YEAR extracts the year from a date.
Syntax:
=YEAR(serial_number)
Enter:
=YEAR(A2)
Result: 2026
The DATE function creates a valid Excel date using a year, month, and day.
=DATE(year, month, day)
Enter:
=DATE(2026,11,27)
Result: 27 November 2026, depending on the cell's date format.
You can use this function when building reports, preparing schedules, and creating dates from separate year, month, and day columns.
Excel allows you to subtract one date from another to calculate the number of days between them.
Imagine a school in Lagos plans to hold an examination on 15 December 2026. The current date is stored in cell A2, while the examination date is stored in B2.
Enter this formula in C2:
=B2-A2
Excel calculates the number of days between the two dates, provided both cells contain valid dates.
You can also use TODAY to calculate the number of days remaining before an event.
=B2-TODAY()
If the examination date is in the future, the result shows the number of days remaining. If the date has already passed, the result will be negative.
DATEDIF calculates the difference between two dates in years, months, or days.
It is useful for calculating a person's age, length of employment, or how long a customer has been registered.
=DATEDIF(start_date, end_date, unit)
The unit tells Excel what type of difference to calculate:
Assume a student's date of birth is stored in cell A2. To calculate the student's age in complete years, enter:
=DATEDIF(A2,TODAY(),"Y")
Excel calculates the number of complete years between the student's date of birth and today's date.
Note: DATEDIF is supported in Excel, although it may not appear in the formula autocomplete suggestions.
Excel can also work with time. This is useful when calculating employee working hours, delivery times, and business operating periods.
HOUR extracts the hour from a time value.
=HOUR(A2)
If A2 contains 3:45 PM, the result is 15 when Excel uses its 24-hour time value.
MINUTE extracts the minute from a time value.
=MINUTE(A2)
If A2 contains 3:45 PM, the result is 45.
SECOND extracts the seconds from a time value.
=SECOND(A2)
If A2 contains 3:45:30 PM, the result is 30.
The TIME function creates a time value using hours, minutes, and seconds.
=TIME(hour, minute, second)
Enter:
=TIME(14,30,0)
Result: 2:30 PM, if the cell is formatted using a 12-hour time format.
This function can help create time schedules and organise business operating hours.
Imagine a company in Lagos wants to calculate how long employees spend at work each day.
| Employee | Time In | Time Out | Hours Worked |
|---|---|---|---|
| Ade | 8:00 AM | 4:00 PM | 8 |
| Mary | 9:00 AM | 5:00 PM | 8 |
| John | 8:30 AM | 3:30 PM | 7 |
If the time employees arrive is stored in column B and the time they leave is stored in column C, enter this formula in D2:
=(C2-B2)*24
Excel stores time as part of a 24-hour day. Multiplying the difference by 24 converts it into hours.
Format the result as a Number to display the number of hours worked.
A computer training centre in Ibadan wants to organise its student registration and class attendance records.
| Student | Registration Date | Class Start Time | Class End Time |
|---|---|---|---|
| David | 05/01/2026 | 9:00 AM | 11:00 AM |
| Mary | 15/03/2026 | 10:00 AM | 12:30 PM |
| John | 20/06/2026 | 8:30 AM | 10:30 AM |
| Grace | 10/09/2026 | 1:00 PM | 3:00 PM |
In this module, you learned how to use Excel date and time functions to organise and analyse time-based information.
These functions are useful for school records, employee attendance, business reports, customer registrations, and project schedules.
In Module 7, you will learn about Lookup and Reference Functions in Excel. You will discover how to find information in large datasets using functions such as VLOOKUP, HLOOKUP, and XLOOKUP.