calendar - logic for calculating ISO year from gregorian year and other fields -
as mentioned above need calculate iso year calendar view, have created view on top of calculating iso week number i'm unable figure out logic calculating iso year, can please post possible.
thanks in advance. kishor
structure of calendar view
replace view sys_calendar.calendar(
calendar_date, day_of_week, day_of_month, day_of_year, day_of_calendar, weekday_of_month, week_of_month, week_of_year, week_of_calendar, month_of_quarter, month_of_year, month_of_calendar, quarter_of_year, quarter_of_calendar, year_of_calendar) sel calendar_date, daynumber_of_week(calendar_date), daynumber_of_month(calendar_date), daynumber_of_year(calendar_date), daynumber_of_calendar(calendar_date), dayoccurrence_of_month(calendar_date), weeknumber_of_month(calendar_date), weeknumber_of_year(calendar_date), weeknumber_of_calendar(calendar_date), monthnumber_of_quarter(calendar_date), monthnumber_of_year(calendar_date), month_of_calendar, quarternumber_of_year(calendar_date), quarter_of_calendar, yearnumber_of_calendar(calendar_date) sys_calendar.calendartmp;
if you're on modern version of teradata, can use td_sysfnlib.yearnumber_of_calendar(calendar_date,'iso')
if take 2014-12-31 example, iso week 1. function correspondingly return 2015 it's iso year.
Comments
Post a Comment