10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

System-defined FunctionsNameinterval (unit,date_interval)_date(s)_time(s)Format(Result)floatanycharacterdata typeanycharacterdata typeDescriptionConverts a date interval into afloating-point constantexpressed in the unit ofmeasurement specified by unit.The interval function assumesthat there are 30.436875 daysper month and 365.2425 daysper year when using the mos,qtrs and yrs specifications.For example, the query:select(interval('days','5 years'))returns the following value:'1826.213'Returns a 9-character stringgiving the date s seconds afterJanuary 1, 1970 GMT. Theoutput format is 'dd-mmm-yy'.For example, the query:select _date(123456)returns the following value:'2-jan-1970'Returns a 5-character stringgiving the time s seconds afterJanuary 1, 1970 GMT. Theoutput format is 'hh:mm'(seconds are truncated).For example, the query:select _time(123456)returns the following value:'02:17'How You Can Use the Date_trunc FunctionYou can use the date_trunc function to group dates. The following expressionis an example of grouping dates within the same month or year:date_trunc('month',date('23-oct-1993 12:33'))This expression returns “1-oct-1993.”Language Elements 59

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!