Calendar Functions (Teradata Database) - Teradata Warehouse Miner

Teradata® Warehouse Miner™ User Guide - Volume 2ADS Generation

Product
Teradata Warehouse Miner
Release Number
5.4.6
Published
November 2018
Language
English (United States)
Last Update
2018-12-07
dita:mapPath
gxn1538171534877.ditamap
dita:ditavalPath
ft:empty
dita:id
B035-2301
Product Category
Software

These functions are only available when connected to a Teradata database.

The following functions generate a UDF call and return an integer value. There is a one-to-one match with these functions and the calendar elements previously described, with the addition here of the function WeekNumber_Of_Quarter (these functions are available only with Teradata 14.00 or later).

Calendar Functions
Function Description
DayNumber_Of_Week Days from beginning of week to date in expression
DayNumber_Of_Month Days from beginning of month to date in expression
DayNumber_Of_Year Days from beginning of year to date in expression
DayNumber_Of_Calendar Days from beginning of business calendar to date in expression
DayOccurrence_Of_Month Nth occurrence of weekday in month for date in expression
WeekNumber_Of_Month Weeks from beginning of month to date in expression
WeekNumber_Of_Year Weeks from beginning of year to date in expression
WeekNumber_Of_Calendar Weeks from beginning of business calendar to date in expression
MonthNumber_Of_Year Months from beginning of year to date in expression
MonthNumber_Of_Quarter Months from beginning of quarter to date in expression
MonthNumber_Of_Calendar Months from beginning of calendar to date in expression
QuarterNumber_Of_Year Quarters from beginning of year to date in expression
QuarterNumber_Of_Calendar Quarters from beginning of calendar to date in expression
YearNumber_Of_Calendar Year portion of date in expression
WeekNumber_Of_Calendar Weeks from beginning of quarter to date in expression

When dragging one of the above SQL elements into a variable, a tree element such as the following is created.

Variable Creation > Input > Variables: SQL Elements pane - Calendar > Calendar Functions

The first argument is the Date or Timestamp column or expression that the given function is applied to as a date. The second argument is optional and should either be left empty (in which case the session calendar is used) or the string literal “Teradata”, “ISO” or “Compatible” should be used to indicate the calendar to use.

The meaning of each of the calendar functions is given in the Description column of the table above.