Differences

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

Link to this comparison view

dev:sql:functions:compare_dates [2010/07/27 17:51]
els
dev:sql:functions:compare_dates [2016/06/28 22:38]
Line 1: Line 1:
-{{page>:​top_add&​nofooter&​noeditbtn}} 
-{{page>:​sql_bar&​nofooter&​noeditbtn}} 
-====== Omnidex SQL Function: $COMPARE_DATES ====== 
-===== Description ===== 
-The $COMPARE_DATES function compares two date expression and returns the difference. ​ The arithmetic is performed using the units declared in the function, or using days if not specified. 
- 
-This function returns an INTEGER datatype. 
- 
-===== Syntax ===== 
- 
-  $COMPARE_DATE( date_expression_1,​ date_expression_2 [ , date_token ] ) 
- 
-== date_expression_1 and date_expression_2 == 
- 
-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]]. ​ 
- 
-== 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}} 
- 
- 
-===== Example ===== 
-==== Example 1: $COMPARE_DATES calculating age  ==== 
- 
-<​code>​ 
-> select birthdate, $compare_dates(birthdate,​ current_date,​ '​YY'​) age from individuals;​ 
- 
-BIRTHDATE ​    AGE 
------------- ​ ----------- 
-  1938-07-14 ​          72 
-  1957-11-22 ​          53 
-  1960-07-28 ​          50 
-  1929-08-22 ​          81 
-  1933-07-09 ​          77 
-  1944-08-01 ​          66 
-  2004-09-14 ​           6 
-</​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/compare_dates.txt ยท Last modified: 2016/06/28 22:38 (external edit)