User Tools

Site Tools


syntax:functions:addyears
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


Previous revision
Next revision
syntax:functions:addyears [2021/08/29 18:38] craigt
Line 1: Line 1:
 +====== AddYears(date, add_years) ======
 +Category:  Date and Time function
 +
 +\\ 
 +=====Description=====
 +This function adds //add_years// number of years to //date// If //add_years// is negative, the years are subtracted.
 +
 +\\ 
 +=====Arguments=====
 +^Argument^Type^Description^
 +|date|Date or Number (date serial)|A expression representing a date.  See "Remarks" below for details.|
 +|add_years |Number |The number of years to be added to //date//, or subtracted if negative.|
 +
 +**Return value type:** Number (date serial value).
 +
 +\\ 
 +=====Remarks=====
 +The //date// argument can take any value or expression that evaluates to a date serial value, with or without a time portion.  Examples include:  
 +  * A date string:  #2019-12-12
 +  * A date serial value: 43811 (the date serial for "2019-12-12")
 +  * A date value created using the [[syntax:functions:date|Date]] function: date("2019-12-12","yyyy-MM-dd").
 +
 +
 +\\ 
 +=====Examples=====
 +
 +  addyears(#2019-12-12, 2)  //Returns 44542 (Equivalent to 2021-Dec-12.)
 +
 +  addyears(43811, 5)  //Returns 45683 (Equivalent to 2024-Dec-12.)
 +
 +  addyears(#2019-12-12, -2)  //Returns 43081 (Equivalent to 2017-Dec-12; subtract years.)
 +
 +
 +\\ 
 +===== See also =====
 +  * [[syntax:functions:addhours|AddHours(date, add_hours)]]
 +  * [[syntax:functions:addmonths|AddMonths(date, add_months)]]
 +  * [[https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx|MSDN: Custom Date and Time Format Strings]]
  
syntax/functions/addyears.txt · Last modified: 2021/08/30 01:54 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki