Archives of the TeradataForum
Message Posted: Thu, 05 Oct 2000 @ 21:38:56 GMT
Subj: | | Re: Sys_calendar and week of the year |
|
From: | | Patricia Thomson |
This is not exciting reading but i'll refer you to Calendrical Calculations by Nachum Dershowitz and Edward M. Reingold. You can get it
from Amazon. It helped me understand the creation of the Teradata calendar view and calculations (sort of -- I am not a mathemetician and a
more advanced brain would probably understand it better. )
I had to create a fiscal calendar which shows our fiscal days, weeks, periods, and year -- which does not correspond exactly to the
calendar days, months, etc. By using the day_of_calendar already provided in Teradata, and taking into account 52 fiscal week years vs 53
fiscal week years, I have a fiscal calendar from 1999 thru FY 2007. This is the first time I ever had a need for the MOD function.
Is this where you are coming from:
CALENDAR_DATE FISCAL_DAY FISCAL_YEAR day_of_week
1999-01-31 1 1999 Sunday
2000-01-30 1 2000 Sunday
2001-01-28 1 2001 Sunday
2002-01-27 1 2002 Sunday
2003-01-26 1 2003 Sunday
2004-02-01 1 2004 Sunday
2005-01-30 1 2005 Sunday
2006-01-29 1 2006 Sunday
2007-01-28 1 2007 Sunday
--
Patricia Thomson
Database Administration and Data Warehouse
|