Differences

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

Link to this comparison view

dev:sql:functions:calc_date [2009/12/18 15:23]
tdo
dev:sql:functions:calc_date [2016/06/28 22:38]
Line 1: Line 1:
-{{page>:​top_add&​nofooter&​noeditbtn}} 
-<​html><​div align="​center"><​span style="​color:​red">​DRAFT</​span></​div></​html>​ 
-====== Omnidex SQL Function: $CALC_DATE ====== 
-{{page>:​sql_bar&​nofooter&​noeditbtn}} 
  
-===== Description ===== 
- 
-$CALC_DATE calculates a new date from a specified date or column_date using a numeric positive or negative offset. ​ The offset defaults to days but can be changed by using the date_unit optional argument. 
-===== Syntax ===== 
- 
-Result = $calc_date( <​date_column | '​date_string'​ >, offset_expression [, date_unit [, options]) 
- 
-Returns a floating point value. 
- 
-===== Discussion ===== 
-== <​date_column_spec | '​date_string'​ > == 
-An expression resulting in date-class or string-class datatype. 
- 
-  
-== offset_expression == 
-An expression resulting in a numeric-class (integer or floating point) value.  ​ 
- 
-Negative values supported. 
-== date_unit == 
- 
-A string containing unit abbreviation that tell the $calc_date function to add or subtract the number of date_units. 
- 
-Valid datefield Options: 
-^ Date_field ^ Description ^ 
-| YEAR | Year | 
-| MONTH | Month | 
-| DAY | Day | 
-| HOUR | Hour | 
-| MINUTE | Minute | 
-| SECOND | Second | 
-| W | Day of the week number (1-Sunday, 2-Monday) |  
-| WW | Three-character day-of-week abbreviation (Sun, Mon) | 
-| WWW | Fully spelled day-of-week (Sunday, Monday) |  
-| M | Non-zero-filled month number (1-January, 2-February) |  
-| 0M | Zero-filled day-of-month number (01-January,​ 02-February) |  
-| MM | Three-character month abbreviation (Jan, Feb) | 
-| MMM | Fully spelled month (January, February) | 
-| D | Non-zero-filled day-of-month (1, 2, 3) | 
-| 0D | Zero-filled day-of-month (01, 02, 03) | 
-| J | Non-zero-filled Julian date (1, 2) | 
-| 0J | Zero-filled Julian date (01, 02) | 
-| YY | Two-digit year (99, 00) | 
-| YYYY | Four-digit year (1999, 2000) |  
-| H | 12-hour, non-zero-filled hour of day (12, 1) | 
-| 0H | 12-hour, zero-filled hour of day (12, 01) | 
-| HH | 24-hour, non-zero-filled hour of day (24, 1) |  
-| 0HH | 24-hour, zero-filled hour of day (24, 01) | 
-| N | Non-zero-filled minute of hour (1, 2) | 
-| 0N | Zero-filled minute of hour (01, 02) | 
-| S | Non-zero-filled second of minute (1, 2) |  
-| 0S | Zero-filled second of minute (01, 02) | 
-| F | Non-zero-filled fraction of a second (1, 2) |  
-| 0F | Zero-filled fraction of a second (01, 02) | 
-| A | Lowercase am/pm indicator | 
-| AA | Uppercase AM/PM indicator | 
- 
- 
-== Options == 
-There are no options currently for this function. 
-  
-===== Example ===== 
-==== Example 1 ==== 
-<​code>​ 
-> select $calc_date('​20090101',​ -5) from $omnidex 
- 
-$CALC_DATE('​20090101',​ 
----------------------- 
-            2008-12-27 
-</​code>​ 
-==== Example 2 ==== 
-<​code>​ 
-> select $calc_date('​20090101',​ -5,YEAR) from $omnidex 
- 
-$CALC_DATE('​20090101',​ 
----------------------- 
-            2004-01-01 
- 
-</​code>​ 
-{{page>:​bottom_add&​nofooter&​noeditbtn}} 
 
Back to top
dev/sql/functions/calc_date.txt ยท Last modified: 2016/06/28 22:38 (external edit)