You are on page 1of 19

Computer Applications : Theory Part

Date and Time Function

 DAY Function:
 Description:
The Microsoft Excel DAY function returns the day of the month (a
number from 1 to 31) given a date value. The DAY function is a built-in
function in Excel that is categorized as a Date/Time Function. It can be
used as a worksheet function (WS) in Excel. As a worksheet function, the
DAY function can be entered as part of a formula in a cell of a worksheet.
A valid date to return the day of the month.

 Syntax:
The syntax for the DAY function in Microsoft Excel is: DAY(
date_value )

 Returns:
The DAY function returns a numeric value between 1 and 31.

 Example (as Worksheet Function):


Let's look at some Excel DAY function examples and explore how to
use the DAY function as a worksheet function in Microsoft Excel:

1. =DAY(A1) Result: 1

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part
2. =DAY(A2) Result: 31

3. =DAY(A3) Result: 15

4. =DAY("12/31/2011") Result: 31

 MONTH Function:
 Description:
The Microsoft Excel MONTH function returns the month (a number from
1 to 12) given a date value. The MONTH function is a built-in function in
Excel that is categorized as a Date/Time Function. It can be used as a
worksheet function (WS) As a worksheet function, the MONTH function
can be entered as part of a formula in a cell of a worksheet. A valid date
to return the month.

 Syntax:
The syntax for the MONTH function in Microsoft Excel is: MONTH(
date_value )

 Returns:
The MONTH function returns a numeric value between 1 and 12.

 Example (as Worksheet Function):


Let's look at some Excel MONTH function examples and explore how
to use the MONTH function as a worksheet function in Microsoft Excel:

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part

1. =MONTH(B2) Result: 9

2. =MONTH(B3) Result: 8

3. =MONTH(B4) Result: 4

4. =MONTH("12/31/2011") Result: 12

 YEAR Function:
 Description:
The Microsoft Excel YEAR function returns a four-digit year (a number
from 1900 to 9999) given a date value. The YEAR function is a built-in
function in Excel that is categorized as a Date/Time Function. It can be
used as a worksheet function (WS) in Excel. As a worksheet function, the
YEAR function can be entered as part of a formula in a cell of a
worksheet. A valid date to return the year value.

 Syntax:
The syntax for the YEAR function in Microsoft Excel is: YEAR(
date_value )

 Returns:
The YEAR function returns a numeric value between 1900 and 9999.

 Example (as Worksheet Function):


Let's look at some Excel YEAR function examples and explore how to
use the YEAR function as a worksheet function in Microsoft Excel:

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part

1. =YEAR(A1) Result: 1999

2. =YEAR(A2) Result: 2001

3. =YEAR(A3) Result: 2003

 NOW Function:
 Description:
The Microsoft Excel NOW function returns the current system date and
time. The NOW function is a built-in function in Excel that is categorized
as a Date/Time Function. It can be used as a worksheet function (WS) in
Excel. As a worksheet function, the NOW function can be entered as part
of a formula in a cell of a worksheet. As a VBA function, you can use this
function in macro code that is entered through the Microsoft Visual Basic
Editor. When used as a worksheet function, the NOW function will
refresh the date/time value whenever the worksheet recalculates. There
are no parameters or arguments for the NOW function.

 Syntax:
The syntax for the NOW function in Microsoft Excel is: NOW()

 Returns:
The NOW function returns a date value.

 Example (as Worksheet Function):

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part
Let's look at some Excel NOW function examples and explore how to
use the NOW function as a worksheet function in Microsoft Excel:

The spreadsheet will continue to display this value, until the worksheet
recalculates. By pressing the F9 key, you can force the worksheet to
recalculate and the NOW function will update its value.

 SECOND Function:
 Description:
The Microsoft Excel SECOND function returns the seconds (a number
from 0 to 59) from a time value. The SECOND function is a built-in
function in Excel that is categorized as a Date/Time Function. It can be
used as a worksheet function (WS) in Excel. As a worksheet function, the
SECOND function can be entered as part of a formula in a cell of a
worksheet. The time value to extract the second from. It may be
expressed as a string value, a decimal number, or the result of a formula.

 Syntax:
The syntax for the SECOND function in Microsoft Excel is: SECOND(
serial_number )

 Returns:
The SECOND function returns a numeric value between 0 and 59.

 Example (as Worksheet Function):


Let's look at some Excel SECOND function examples and explore how
to use the SECOND function as a worksheet function in Microsoft
Excel:

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part

1. =SECOND(A1) Result: 35

2. =SECOND(A2) Result: 0

3. =SECOND("4:00:03 AM") Result: 3

4. =SECOND("4:30:24 AM") Result: 24

 MINUTE Function:
 Description:
The Microsoft Excel MINUTE function returns the minutes (a number
from 0 to 59) from a time value. The MINUTE function is a built-in
function in Excel that is categorized as a Date/Time Function. It can be
used as a worksheet function (WS) in Excel. As a worksheet function, the
MINUTE function can be entered as part of a formula in a cell of a
worksheet. The time value to extract the minutes from. It may be
expressed as a string value, a decimal number, or the result of a formula.

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part

 Syntax:
The syntax for the MINUTE function in Microsoft Excel is: MINUTE(
serial_number )

 Returns:
The MINUTE function returns a numeric value between 0 and 59.

 Example (as Worksheet Function):


Let's look at some Excel MINUTE function examples and explore how
to use the MINUTE function as a worksheet function in Microsoft
Excel:

1. =MINUTE(A2) Result: 10

2. =MINUTE(A3) Result: 55

3. =MINUTE(A4) Result: 45

4. =MINUTE(A5) Result: 30

5. =MINUTE("4:00:00 AM") Result: 0

6. =MINUTE("4:30:00 AM") Result: 30

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part

 HOUR Function:
 Description:
The Microsoft Excel HOUR function returns the hours (a number from 0
to 23) from a time value. The HOUR function is a built-in function in
Excel that is categorized as a Date/Time Function. It can be used as a
worksheet function (WS) in Excel. As a worksheet function, the HOUR
function can be entered as part of a formula in a cell of a worksheet. The
time value to extract the hour from. It may be expressed as a string value,
a decimal number, or the result of a formula.

 Syntax:
The syntax for the HOUR function in Microsoft Excel is: Hour(
serial_number )

 Returns:
The HOUR function returns a numeric value between 0 and 23.

 Example (as Worksheet Function):


Let's look at some Excel HOUR function examples and explore how to
use the HOUR function as a worksheet function in Microsoft Excel:

1. =HOUR(A1) Result: 13

2. =HOUR(A2) Result: 7

3. =HOUR("4:30:00 AM") Result: 4

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part

4. =HOUR("4:30:00 PM") Result: 16

 Today function:
 Description:
he Microsoft Excel TODAY function returns the current system date. This
function will refresh the date whenever the worksheet recalculates. The
TODAY function is a built-in function in Excel that is categorized as a
Date/Time Function. It can be used as a worksheet function (WS) in Excel. As a
worksheet function, the TODAY function can be entered as part of a formula in
a cell of a worksheet. There are no parameters or arguments for the TODAY
function.

 Syntax:
The syntax for the TODAY function in Microsoft Excel is: TODAY()

 Returns:
The TODAY function returns a serial date value. A serial date is how
Excel stores dates internally and it represents the number of days since
January 1, 1900.

 Example (as Worksheet Function):


Let's look at some Excel TODAY function examples and explore how to
use the TODAY function as a worksheet function in Microsoft Excel:

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part
The spreadsheet will continue to display this value, until the worksheet
recalculates. By pressing the F9 key, you can force the worksheet to recalculate
and the TODAY function will update its value.

 EDATE Function:
 Description:
The Microsoft Excel EDATE function adds a specified number of months to a
date and returns the result as a serial date. The EDATE function is a built-in
function in Excel that is categorized as a Date/Time Function. It can be used as
a worksheet function (WS) in Excel. As a worksheet function, the EDATE
function can be entered as part of a formula in a cell of a worksheet. start_date:
The starting date to use in the calculation. Months : The number of months to
add to the start_date. It can be a positive or negative value.

 Syntax:
The syntax for the EDATE function in Microsoft Excel is: EDATE(
start_date, months )

 Returns:
The EDATE function returns a serial date value. A serial date is how
Excel stores dates internally and it represents the number of days since
January 1, 1900.

If start_date is not a valid date, the EDATE function will return the
#VALUE! error.

 Example (as Worksheet Function):


Let's look at some Excel EDATE function examples and explore how to use the
EDATE function as a worksheet function in Microsoft Excel:

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part

The result of the EDATE function is a serial date and can be seen in
column C above.

Most often you will want a formatted date rather than a serial date.
Column D demonstrates the serial date returned by the EDATE
function that has been formatted using mmm d, yyyy.

Based on the Excel spreadsheet above, the following EDATE


examples would return:

1. =EDATE(A2,B2)
Result: 42426 'Which can be formatted as "Feb 26, 2016"

2. =EDATE(A3,B3)
Result: 42475 'Which can be formatted as "Apr 15, 2016"

3. =EDATE(A4,B4)
Result: 42617 'Which can be formatted as "Sep 4, 2016"

4. =EDATE(A5,B5)
Result: 42520 'Which can be formatted as "May 30, 2016"

5. =EDATE("1/27/2016",3)
Result: 42487 'Which can be formatted as "Apr 27, 2016"

 WORKDAY Function
 Description:
The Microsoft Excel WORKDAY function adds a specified number of work
days to a date and returns the result as a serial date. Weekends are not
considered work days and you can specify holidays to also exclude from the

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part
work day calculation. The WORKDAY function is a built-in function in Excel
that is categorized as a Date/Time Function. It can be used as a worksheet
function (WS) in Excel. As a worksheet function, the WORKDAY function can
be entered as part of a formula in a cell of a worksheet. Start_date: The starting
date to use in the calculation and should be entered as a serial date, not a text
date. Days: The number of work days added to start_date. Holidays : Optional.
It is the list of holidays to exclude as work days from the calculation. It can be
entered either as a range of cells that contain the holiday dates (ie: G2:G5) or as
a list of serial numbers that represent the holiday dates.

 Syntax:
The syntax for the WORKDAY function in Microsoft Excel is:
WORKDAY( start_date, days, [holidays] )

 Returns:
The WORKDAY function returns a serial date value. A serial date is how
Excel stores dates internally and it represents the number of days since
January 1, 1900.

 Note
1. Weekends are defined as Saturday and Sunday. If you want to use
different days as the weekend, try the WORKDAY.INTL function.

2. If a decimal value is provided for days, the WORKDAY function will


only add the integer portion to start_date.

3. If you enter a range of cells for the holidays, enter the range as an
absolute value so that the range does not change when copying the
formula to different cells. For example, if your holidays are stored in
the range G2:G5, it is best to enter the range as $G$2:$G$5.

 Example (as Worksheet Function):


Let's look at some Excel WORKDAY function examples and explore
how to use the WORKDAY function as a worksheet function in
Microsoft Excel:

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part

The result of the WORKDAY function is a serial date and can be seen in
column C above.

Most often you will want a formatted date rather than a serial date.
Column D demonstrates the serial date returned by the WORKDAY
function that has been formatted using mmm d, yyyy.

 Enter Holidays as a Range


The holidays parameter is optional and is usually entered as a range of
cells. In our example, holidays are found in the range of $G$2:$G$5.

Based on the Excel spreadsheet above, the following WORKDAY


examples would return:

1. =WORKDAY(A2,B2,$G$2:$G$5)
Result: 42369 'Which can be formatted as "Dec 31, 2015"

2. =WORKDAY(A3,B3,$G$2:$G$5)
Result: 42373 'Which can be formatted as "Jan 4, 2016"

3. =WORKDAY(A4,B4,$G$2:$G$5)
Result: 42458 'Which can be formatted as "Mar 29, 2016"

4. =WORKDAY(A5,B5,$G$2:$G$5)
Result: 42464 'Which can be formatted as "Apr 4, 2016"

 Enter Holidays as Text Dates


Holidays do not have to be entered as a range of cells. They can also be entered
as text dates. However how you enter text dates depends on whether you enter
one date or more than one date.

For example, here is how you would enter a single date as a holiday:

1. =WORKDAY(A2,B2,"1/1/2016") Result: 42369 'Which can be


formatted as "Dec 31, 2015"

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part
This formula would treat Jan 1, 2016 as a holiday and exclude it from the work
day calculation.

If you want to enter more than one holiday as a text date, you will need to enter
the dates as an array. For example:

1. =WORKDAY(A5,B5,{"1/1/2016","3/25/2016","3/28/2016","12/25/2016
"}) Result: 42464 'Which can be formatted as "Apr 4, 2016"

This WORKDAY function would treat 1/1/2016, 3/25/2016, 3/28/2016 and


12/25/2016 as holidays and will not include them as work days.

 Enter Holidays as Serial Dates


Finally, let's explore how to enter holidays as serial dates. Entering the holidays
as serial dates ensures that Excel processes the dates properly. Remember that
how you enter a holiday as a serial date depends on whether you are entering
one date or more than one date. For example, here is how to enter a single serial
date for holidays:

1. =WORKDAY(A2,B2,42370)
Result: 42369 'Which can be formatted as "Dec 31, 2015"
Since 42370 is the serial date for Jan 1, 2016, that date will be excluded from
the work day calculation.

If you want to enter more than one holiday as a serial date, you need to include
your serial dates as an array. For example:

1. =WORKDAY(A5,B5,{42370,42454,42457,42729})
Result: 42464 'Which can be formatted as "Apr 4, 2016"
Since 42370 is 1/1/2016, 42454 is 3/25/2016, 42457 is 3/28/2016 and 42729 is
12/25/2016, these dates will not be included as work days.

TIP: To see the numeric value for any serial date, change the format of the cell
to General. It will then display the serial date value.

 WORKDAY.INTL Function:
 Description:
The Microsoft Excel WORKDAY.INTL function adds a specified number of
work days to a date and returns the result as a serial date. Weekends are
customizable and are not considered work days. You can also specify holidays
to exclude from the work day calculation. The WORKDAY.INTL function is a
built-in function in Excel that is categorized as a Date/Time Function. It can be
used as a worksheet function (WS) in Excel. As a worksheet function, the

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part
WORKDAY.INTL function can be entered as part of a formula in a cell of a
worksheet.
 Start_date
The starting date to use in the calculation and should be entered as a serial date,
not a text date.

 Days
The number of work days added to start_date.

 Weekend
Optional. It determines which days of the week are considered weekends. It can
be one of the following values:

Value Explanation
1 (default) The weekend is Saturday and Sunday
2 The weekend is Sunday and Monday
3 The weekend is Monday and Tuesday
4 The weekend is Tuesday and Wednesday
5 The weekend is Wednesday and Thursday
6 The weekend is Thursday and Friday
7 The weekend is Friday and Saturday
11 The weekend is only Sunday
12 The weekend is only Monday
13 The weekend is only Tuesday
14 The weekend is only Wednesday
15 The w eekend is only Thursday
16 The weekend is only Friday
17 The weekend is only Saturday

 Holidays
Optional. It is the list of holidays to exclude as work days from the calculation.
It can be entered either as a range of cells that contain the holiday dates (ie:
G3:G6) or as a list of serial numbers that represent the holiday dates.

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part

 Syntax:
The syntax for the WORKDAY.INTL function in Microsoft Excel is:
WORKDAY.INTL( start_date, days, [weekend], [holidays] )

 Returns:
The WORKDAY.INTL function returns a serial date value. A serial date
is how Excel stores dates internally and it represents the number of days
since January 1, 1900.

 Note
 If a decimal value is provided for days, the WORKDAY.INTL
function will only add the integer portion to start_date.
 If you enter a range of cells for the holidays, enter the range as an
absolute value so that the range does not change when copying
the formula to different cells. For example, if your holidays are
stored in the range G3:G6, it is best to enter the range as
$G$3:$G$6.
 A serial date is how Excel stores dates internally and it represents
the number of days since January 1, 1900.

 Example (as Worksheet Function):


Let's look at some Excel WORKDAY.INTL function examples and explore
how to use the WORKDAY.INTL function as a worksheet function in
Microsoft Excel:

The result of the WORKDAY.INTL function is a serial date and can be seen in
column C above. Most often you will want a formatted date rather than a serial
date. Column D demonstrates the serial date returned by the WORKDAY.INTL
function that has been formatted using mmm d, yyyy.

 Enter Holidays as a Range


The holidays parameter is optional and is usually entered as a range of cells. In
our example, holidays are found in the range of $G$3:$G$6.

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part

Based on the Excel spreadsheet above, the following WORKDAY.INTL


examples would return:

1. =WORKDAY.INTL(A3,B3,1,$G$3:$G$6)
Result: 42369 'Which can be formatted as "Dec 31, 2015"

2. =WORKDAY.INTL(A4,B4,1,$G$3:$G$6)
Result: 42373 'Which can be formatted as "Jan 4, 2016"

3. =WORKDAY.INTL(A5,B5,1,$G$3:$G$6)
Result: 42458 'Which can be formatted as "Mar 29, 2016"

4. =WORKDAY.INTL(A6,B6,1,$G$3:$G$6)
Result: 42464 'Which can be formatted as "Apr 4, 2016"

In these examples, we have used a weekend parameter of 1 which means that


the weekend includes both Saturday and Sunday. You can customize the
weekend by changing this parameter.

 Enter Holidays as Text Dates


Holidays do not have to be entered as a range of cells. They can also be entered
as text dates. However how you enter text dates depends on whether you enter
one date or more than one date. For example, here is how you would enter a
single date as a holiday:

1. =WORKDAY.INTL(A3,B3,1,"1/1/2016")
Result: 42369 'Which can be formatted as "Dec 31, 2015"

This formula would treat Jan 1, 2016 as a holiday and exclude it from the work
day calculation. If you want to enter more than one holiday as a text date, you
will need to enter the dates as an array.

For example:

1. =WORKDAY.INTL(A6,B6,1,{"1/1/2016","3/25/2016","3/28/2016","12/
25/2016"})
Result: 42464 'Which can be formatted as "Apr 4, 2016"

This WORKDAY.INTL function would treat 1/1/2016, 3/25/2016, 3/28/2016


and 12/25/2016 as holidays and will not include them as work days.

 Date Value Function:


 Description:

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part
The Microsoft Excel DATEVALUE function returns the serial number of a
date. The DATEVALUE function is a built-in function in Excel that is
categorized as a Date/Time Function. It can be used as a worksheet function
(WS) in Excel. As a worksheet function, the DATEVALUE function can be
entered as part of a formula in a cell of a worksheet. A string representation of a
date.

 Syntax:
The syntax for the DATEVALUE function in Microsoft Excel is:
DATEVALUE( date )

 Returns:
The DATEVALUE function returns a date value when used as a VBA
function and it returns a serial date when used as a worksheet function. A
serial date is how Excel stores dates internally and it represents the
number of days since January 1, 1900.

 Example (as Worksheet Function):


Let's look at some Excel DATEVALUE function examples and explore
how to use the DATEVALUE function as a worksheet function in
Microsoft Excel:

1. =DateValue(A1) Result: 41153

2. =DateValue(A2) Result: 41152

3. =DateValue(A3) Result: 41501

Tarjani

BRCM College of Business Administration


Computer Applications : Theory Part
4. =DateValue("30-Nov-2012") Result: 41243

Tarjani

BRCM College of Business Administration

You might also like