Differences

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

Link to this comparison view

dev:sql:functions:calc_date [2011/01/25 23:53]
els
dev:sql:functions:calc_date [2016/06/28 22:38]
Line 1: Line 1:
-{{page>:​top_add&​nofooter&​noeditbtn}} 
-====== Development:​ Omnidex SQL ====== 
- 
-===== SQL Functions: $CALC_DATE ====== 
- 
-==== Description ==== 
-The $CALC_DATE function performs arithmetic on a date expression, returning a new date value. ​ The arithmetic is performed using the units declared in the function, or using DAYS if not specified. 
- 
-This function returns the same datatype as the passed date expression. 
- 
-==== Syntax ==== 
- 
-  $CALC_DATE( date_expression,​ numeric_expression [ , date_token ] ) 
- 
-== date_expression == 
- 
-Required. Any expression that returns a date-class datatype. Examples of date expressions are columns or functions that return a date-class datatype. ​ The date-class datatypes are any of the date or time oriented datatypes found in the list of [[dev:​appendix:​reference:​datatypes|Omnidex datatypes]]. ​ 
- 
-== numeric_expression == 
- 
-Required. Any expression that returns a numeric-class datatype. Examples of numeric expressions are columns, functions or expressions that return a numeric-class datatype. ​ The numeric datatypes are found in the list of [[dev:​appendix:​reference:​datatypes|Omnidex datatypes]]. ​ 
- 
-If this function is to return a date in the future, the numeric expression should return a positive value. ​ If this function is to return a date in the past, the numeric expression should return a negative value. 
- 
-== date_token == 
- 
-Optional. One of the following tokens representing the unit for the date arithmetic. 
- 
-{{page>​dev:​appendix:​reference:​date_tokens_insert&​noheader&​nofooter&​noeditbtn}} 
- 
- 
-== date_column == 
- 
-Required. A column that is declared as a date_class datatype. ​ The date_class datatypes are any of the date or time oriented datatypes found in the list of [[dev:​appendix:​reference:​datatypes|Omnidex datatypes]]. ​ 
- 
- 
-==== Example ==== 
-=== Example 1: $CALC_DATE adding 18 years === 
- 
-<​code>​ 
-> select birthdate, $calc_date(birthdate,​ 18, '​YY'​) bday_plus_18 from individuals;​ 
- 
-BIRTHDATE ​    ​BDAY_PLUS_18 
------------- ​ ------------ 
-  1938-07-14 ​   1956-07-14 
-  1957-11-22 ​   1975-11-22 
-  1960-07-28 ​   1978-07-28 
-  1929-08-22 ​   1947-08-22 
-  1933-07-09 ​   1951-07-09 
-  1944-08-01 ​   1962-08-01 
-  2004-09-14 ​   2022-09-14 
-</​code>​ 
- 
-====== Additional Resources ====== 
- 
-See also: 
-{{page>​dev:​sql:​functions:​see_also_dates&​noheader&​nofooter&​noeditbtn}} 
- 
-{{page>:​bottom_add&​nofooter&​noeditbtn}} 
  
 
Back to top
dev/sql/functions/calc_date.txt ยท Last modified: 2016/06/28 22:38 (external edit)