Difference between revisions of "Documentation/How Tos/Calc: YEARS function"
From Apache OpenOffice Wiki
< Documentation | How Tos
OOoWikiBot (Talk | contribs) m (Robot: Automated text replacement %s) |
m |
||
Line 44: | Line 44: | ||
* [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]] | * [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]] | ||
* [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]]}} | * [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]]}} | ||
− | [[Category: Documentation/Reference/Calc]] | + | [[Category: Documentation/Reference/Calc/Date and Time functions]] |
Revision as of 06:54, 13 April 2010
YEARS
Returns the number of years between two dates.
This function is only available if the Analysis AddIn is installed.
Syntax:
YEARS(startdate; enddate; mode)
- If mode is 0, YEARS returns the number of whole years between startdate and enddate, day/month to day/month.
- If mode is 1, YEARS identifies the year that startdate and enddate each lie in, and returns the difference between those years. In other words it returns YEAR(enddate) - YEAR(startdate)
- If startdate is after enddate the result will be negative.
Example:
YEARS("2009-04-03"; "2011-11-17"; 0)
- returns 2.
YEARS("2011-02-28"; "2012-02-28"; 0)
- returns 1. 2012 is a leap year, but 28th February to 28th February is classed as a whole year.
YEARS("2012-02-29"; "2013-02-28"; 0)
- returns 0. 2012 is a leap year, but 29th February to 28th February is not classed as a whole year, even though both dates are the last day of February.
YEARS("2009-04-03"; "2011-11-17"; 1)
- returns 2.
YEARS("2009-12-31"; "2010-01-01"; 1)
- returns 1. Even though there is only one day between the dates, they lie in different years.
Issues:
- This function is not available in Excel.