Difference between revisions of "Documentation/How Tos/Calc: YEARS function"
From Apache OpenOffice Wiki
< Documentation | How Tos
(Issues) |
(→See also:) |
||
Line 34: | Line 34: | ||
'''[[Documentation/How_Tos/Calc: WEEKS function|WEEKS]]''', | '''[[Documentation/How_Tos/Calc: WEEKS function|WEEKS]]''', | ||
'''[[Documentation/How_Tos/Calc: MONTHS function|MONTHS]]''' | '''[[Documentation/How_Tos/Calc: MONTHS function|MONTHS]]''' | ||
+ | |||
+ | '''[[Documentation/How_Tos/Calc: Date & Time functions#Date and Time overview|Date & Time overview]]''' | ||
'''[[Documentation/How_Tos/Calc: Date & Time functions|Date & Time functions]]''' | '''[[Documentation/How_Tos/Calc: Date & Time functions|Date & Time functions]]''' | ||
− | '''[[Documentation/How_Tos/Calc: | + | [[Documentation/How_Tos/Calc: Functions listed alphabetically|'''Functions listed alphabetically''']], |
+ | [[Documentation/How_Tos/Calc: Functions listed by category|'''Functions listed by category''']] | ||
=== Issues: === | === Issues: === | ||
* This function is not available in Excel. | * This function is not available in Excel. |
Revision as of 07:16, 12 September 2008
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.
See also:
Functions listed alphabetically, Functions listed by category
Issues:
- This function is not available in Excel.