Sunteți pe pagina 1din 13

Date and Time

ITC-2015, Week-2, Session-6

Dates stored as serial number


Time stored as decimal number
Date:
January 1, 1900 = 1
Any date before isnt recognised (i.e., no ve date)

1st July 2015 = 42186

Time:
Starts at midnight (12:00 am or 0:00)
Each hour = 1/24 of a day, i.e., 0.041666

1st July 2015 09:00 am = 42186.375


2

When a time is specified without a


date, Excel stores it as if it occurred on
January 0, 1900 (nondate, serial 0)
3:00 pm stored as 0.625
makes doing math for time-only values (that have
no date) challenging

A minute is 1/60 of an hour, which is 1/24 of a


day, or 1/1440 of a day in total, which
calculates to 0.00069444
A second is 1/60 of an minute, which is 1/60 of
an hour, which is 1/24 of a day, or 1/86400 of a
day in total, which calculates
to 0.00001157407
3

Choose Your Date System: 1900 or 1904


1900 date system
Jan.1, 1900, as the base date
By default, Excel for Windows uses this, but also
supports the 1904 date system for compatibility
with Macintosh files

1904 date system

Jan.1, 1904, as the base date


Pre-2011 versions of Excel for Mac use this
Excel 2011 for Mac uses the 1900 by default
Advantage
enables display of negative time values

Excel's leap year bug


Although the year 1900 was not a leap year, Excel
treats it as such
when you type 2/29/1900 into a cell, Excel interprets it as a
valid date and assigns a serial number of 60

But, if you type 2/29/1901, however, Excel correctly


interprets it as a mistake and doesn't convert it to a
date
Rather, it simply makes the cell entry a text string

Historical Reason:
The original version of Lotus 1-2-3 contained a bug that
caused it to consider 1900 as a leap year.
When Excel was released some time later, the designers
knew of this bug and chose to reproduce it in Excel to
maintain compatibility with Lotus worksheet files
5

Caution while using 2-digit years


Two-digit years between 00 and 29
interpreted as 21st century dates,

Two-digit years between 30 and 99


interpreted as 20th-century dates.

12/15/28
Excel interprets as December 15, 2028

12/15/30,
Excel sees it as December 15, 1930,

because Windows uses a default boundary


year of 2029
6

Date
Functions
* In pre-Excel 2007
versions, these
functions are available
only when the Analysis
ToolPak add-in is
installed.
** introduced in Excel
2010.
*** introduced in Excel
2013.

DATE() and TIME()


=DATE(year, month, day)
=DATE(2015,7,1) =>12:00 am on 1st July, 2015

=TIME(hours, minutes, seconds)


=TIME(18,0,0) => 6:00 pm on Jan.1, 1900

=DATE(2015,7,1)+TIME(18,0,0)
Gets stored as 42186.75

TODAY() and NOW()


TODAY function always returns the current
dates serial number
NOW always returns the current date and
times serial number

EDATE() and EOMONTH


EDATE gives the date of the specified number of
months away from the input date
=EDATE(start_date, months)

EOMONTH gives the date of the last day of the month


It can do so for the current month or a number of months in
the future or the past
=EOMONTH(start_date, months)

start_date
any date-formatted cell reference or date serial number

Months
any number, though only the integer value will be used
e.g. it treats 2.8 as 2
10

Both functions strip the time value from the date

WORKDAY()
WORKDAY counts ahead based on work-days (Mon.Fri.) instead of all 7 days of the week
=WORKDAY(start_date, days, [holidays])
start_date
any date-formatted cell reference or date serial number

Days
No. of workdays ahead (or behind) of the present day

[holidays]
optional, but lets us disqualify holidays, which might otherwise fall
during the work week.
date serial numbers provided in an array bounded by brackets: { }.
To specify multiple holidays, the dates must be held in cells
it is not possible to put multiple DATE functions in an array

=WORKDAY(A1,-6,DATE(2014,8,8))
11

WORKDAY.INTL()
Similar to WORKDAY, but it adds the ability to
customize the definition of the weekend
=WORKDAY.INTL(start_date, days, [weekend], [holidays])
[weekend]

12

Weekend string values are 7 characters long and each character in


the string represents a day of the week, starting with Monday
1 represents a non-workday and 0 represents a workday. Only the
characters 1 and 0 are permitted in the string.
0000011would result in a weekend that is Saturday and Sunday

DAY(), MONTH(), and YEAR()


=DAY(serial_number)
=MONTH(serial_number)
=YEAR(serial_number)

13

HOUR(), MINUTE(), and SECOND()


=HOUR(serial_number)
=MINUTE(serial_number)
=SECOND(serial_number)

14

WEEKDAY() and WEEKNUM()


=WEEKDAY(serial_number, [return_type])
=WEEKNUM(serial_number, [return_type])
serial_number
any date-formatted cell reference

[return_type]
optional, and assumes that each week starts on Sunday

15

Counting and Tracking Dates


NETWORKDAYS()
=NETWORKDAYS(start_date, end_date, [holidays])

NETWORKDAYS.INTL()
=NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays])

16

YEARFRAC takes 2 dates and provides


the portion of the year between them
If we need to measure how much time has passed
in years, but subtracting the YEAR function will
only round down to the nearest full year.

YEARFRAC function gives you the difference


between dates as a fraction of a year
=YEARFRAC(start_date, end_date, [basis])
[basis]
optional, but we can specify the rules for
measuring the difference. Usually, we use option 1
17

DATEDIF() (Undocumented Function)


Can do much more than YEARFRAC
Tells us the number of years, months, or days
between two dates
can also track based on only partial inputs, ignoring
years or months when calculating days
=DATEDIF(start_date, end_date, unit)
unit
a string, in quotes ( ), that represents the type of
output we want

18

DATEVALUE() and TIMEVALUE()


=DATEVALUE(date_text)

=TIMEVALUE(time_text)

19

Converting Dates and Times to Text


Sometimes, we need to look for a date in a text
string, and have to match using string tools
like FIND and SEARCH
TEXT() converts dates and times to text strings
=TEXT(value, format_text)

20

Converting Dates and Times to Text

21

Converting Dates and Times to Text

22

Converting Dates and Times to Text

Refer Excel Help

23

Converting Dates and Times to Text

Refer Excel Help

24

Converting Dates and Times to Text

Refer Excel Help

25

Thanks

26

S-ar putea să vă placă și