M3 - T6 - Date and Time Functions - Final
M3 - T6 - Date and Time Functions - Final
Date/Time Functions
Excel works not only with numbers and text string, but with dates and times too! This guide will cover
date and time functions.
1. Formatting Dates and Times
2. Using Date and Time Functions
3. Calculating the difference between two dates
4. Calculating the difference between two times
How are dates stored in Excel?
Dates work differently from numbers in Excel. Days are limited from 1 to 31 and months are limited to
12. So how does Excel store dates?
Dates are stored as serial numbers, counted sequentially beginning from a reference date of 1st January
1900, which is represented by serial number 1.
Date Formatting
Dates need to be stored in the proper date format in terms of their respective serial numbers, instead
of text format.
Just by looking at a cell we can find out if it is in date form. Cell values in date format are aligned to the
right of a cell.
Excel can display and recognize multiple date formats. Here are some examples:
1/1/2018
1-Jan-18
January 1, 2018
Sunday, January 01, 2018
Page 1 of 9
Date/Time Functions – Excel 2016
To apply date format to a cell, click on the cell number format dropdown box (arrow to the right of
‘General’) and then select either ‘Short Date’ or ‘Long Date’ for pre-set date formats.
Alternatively, select ‘More Number Formats’. In the popup menu, click on the category ‘Date’ and
select the type of date format we want.
We can also select the location we are living in to use the location-specific date format for our
worksheet.
Page 2 of 9
Date/Time Functions – Excel 2016
If you want to create your own date format, click on Custom and type in the date format you want, for
example “d-mmm-yyyy”.
Time Formatting
Similarly, Excel stores time as a numerical value. Again, to format a cell in time format, select the cell
and then select ‘Time’ from the number format dropdown. To choose a different time format, click on
‘More Number Formats’ and select a format from the right pane.
Notice that the first time format has an asterisk sign (*) next to it. This highlights that the cell value will
change according to the default time settings on your computer.
Page 3 of 9
Date/Time Functions – Excel 2016
To customise your own time format, click on ‘Custom’.
Now that we know how to apply date and time format settings correctly, we can use functions to
perform calculations involving such values.
Let’s now look at the following ‘Date and Time Functions’:
• DATE, YEAR, MONTH, DAY
• TODAY
• NOW
• Difference between two times
• Difference between two dates
• EOMONTH
• EDATE
• NETWORK DATES
Page 4 of 9
Date/Time Functions – Excel 2016
Basic Date and Time Functions
DATE, YEAR, MONTH, DAY
A date is made up of a day, month and year. We can use the oblique symbol (/) or dash symbol (-) to
write a date in this format. The default date format in Excel is “dd/mm/yyyy”.
DATE Function
When we have three separate numbers indicating a day, month, and year, we can use the DATE
function to help us combine them quickly into date format.
The syntax of this function is “=DATE(year,month,day)”
In the example below, if we enter the “= DATE(C2,B2,A2)” into cell D2, we will obtain the combined
numbers in Excel’s default date format.
Result:
YEAR, MONTH, DATE Functions
To obtain just the year, month or day from a cell in date format, we can use the YEAR, MONTH & DAY
functions respectively.
Result:
Result:
Result:
Page 5 of 9
Date/Time Functions – Excel 2016
TODAY function
To get today's date, click on a cell and type in the function “=TODAY()”.
The keyboard shortcut is: “Ctrl + Semicolon (;)”
NOW function
To get today's date and time, click on a cell and type in the function =NOW().
The keyboard shortcut is: “Ctrl + Shift + Semicolon (;)”
Note: The functions TODAY and NOW will update automatically to the current
date / time, just like a clock. But using the keyboard shortcuts Ctrl+Semicolon or
Ctrl+Shift+Semicolon will result in a static date or time that will not auto-update.
This can be useful for recording down the working hours you works in a day,
flight timings, or tracking progress made on your study schedule!
Page 6 of 9
Date/Time Functions – Excel 2016
Result:
HOUR, MINUTE, SECOND Functions
To obtain the hour, minute, or second from a cell in time format, we can use the HOUR, MINUTE &
SECOND functions respectively.
Result:
Result:
Result:
Page 7 of 9
Date/Time Functions – Excel 2016
Difference between two dates
Since dates and times are stored as numbers, we can add or subtract them to calculate the difference
between them.
Example
If Food2Go’s last social media promotional post was five days ago, what date was that?
We can use the TODAY function to calculate this: “ = TODAY () – 5 ”
Result:
Example
Ishan’s laptop is 2 years, 3 months and 4 days old on 06/06/2018. When did Ishan purchase his laptop?
Let’s use the DATE function to find out!
1. In Cell A1, type in the date “06/06/2018”.
2. In another cell, type in the formula: “ = DATE (YEAR (A1) – 2 , MONTH (A1) – 3 , DAY (A1) – 4 )”
3. Press Enter.
Result:
Result:
Page 8 of 9
Date/Time Functions – Excel 2016
EOMONTH
The EOMONTH function returns the last day of a month that is a specified number of months before or
after a start date (start_date).
This function can be used to calculate maturity dates.
The EOMONTH function in the example below will tell us the last day of the month that is 1 month
after 6 July 2018 (start date).
Result:
EDATE
The EDATE function adds or subtracts a specified number of months to a given date to compute a new
date.
The EDATE function in the example below will tell us the date exactly 1 month after 6 July 2018 (start
date).
Result:
NETWORKDAYS
The NETWORKDAYS function computes the total number of whole working days between two dates.
*Weekends are automatically excluded, and you have the option of specifying holiday dates to be
excluded also.
The NETWORKDAYS function in the example below will tell us how many working days there are
between 6 July 2018 and 6 July 2019.
Result:
Page 9 of 9