10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

System-defined FunctionsThe following expression:date_trunc('year',date('23-oct-1993'))returns “1-jan-1993”.Truncation takes place in terms of calendar years and quarters (“1-jan,” “1-apr,” “1-jun,” and “1-oct”).To truncate in terms of a fiscal year, you must offset the calendar date by thenumber of months between the beginning of your fiscal year and the beginningof the next calendar year (“6 mos” for a fiscal year beginning July 1, or “4mos” for a fiscal year beginning September 1):date_trunc('year',date+'4 mos') - '4 mos'How You Can Use the Date_part FunctionWeeks start on Monday. The beginning of a week for an early January datemay fall into the previous year.The date_part function is useful in set functions and in assuring correctordering in complex date manipulation. For example, if date_field contains thevalue “23-oct-1993” then:date_part('month',date(date_field))returns a value of 10 (representing October), and:date_part('day',date(date_field))returns a value of 23.The date_part function uses the following values:ValuemonthshoursDescriptionUse numbers 1 to 12, starting with JanuaryReturned according to the 24-hour clockquarters Numbered 1 through 4weeksdatesWeek 1 begins on the first Monday of the yearDates before the first Monday of the year are considered to bein week 060 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!