Jan, In addition to all the cool functions Razzak mentioned, I keep three very simple tables in most databases that let me build a calendar with a row for every day very easily. It is especially useful for an INSERT INTO tablename SELECT stuff FROM viewOrTableName WHERE whatever.
CREATE TABLE MonthNumbers (MonthNumber INTEGER NOT NULL PRIMARY KEY) SET VAR vNum INT = 1 WHILE vNum <= 12 THEN INSERT INTO MonthNumbers VALUES (.vNum) SET VAR vNum = (.vNum + 1) ENDWHILE CREATE TABLE DayNumbers (DayNumber INTEGER NOT NULL PRIMARY KEY) SET VAR vNum INT = 1 WHILE vNum <= 31 THEN INSERT INTO DayNumbers VALUES (.vNum) SET VAR vNum = (.vNum + 1) ENDWHILE CREATE TABLE YearNumbers (YearNumber INTEGER NOT NULL PRIMARY KEY) SET VAR vNum INT = 1901 WHILE vNum <= 2099 THEN INSERT INTO YearNumbers VALUES (.vNum) SET VAR vNum = (.vNum + 1) ENDWHILE With those 3 tables and Razzak's list of functions, you can create a view from these three tables that has a row for each day, and knows everything there is to know about that calendar day. Just be careful not to create any February 31 dates. Bill On Tue, Dec 2, 2008 at 11:34 AM, A. Razzak Memon <[EMAIL PROTECTED]> wrote: > At 11:19 AM 12/2/2008, jan johansen wrote: > > Looking for a slick way to find the dates Monday thru Friday of a week. >> For example Christmas is Day 4 of Week 52. I need to populate a list so >> the result dates should be >> 12/22/2008 - day 1 week 52 >> 12/23/2008 - day 2 week 52 >> 12/24/2008 - day 3 week 52 >> 12/25/2008 - day 4 week 52 >> 12/26/2008 - day 5 week 52 >> >> With the resultant list I can do a selected INSERT into a table. >> > > Jan, > > FWIW, take a look at the new DATE functions, including the following: > > . Integer Day of the Year (IDOY(date)) > . Integer Week of the Year ((IWOY(date)) > . Integer Days in a Month ((IDIM(date)) > . Is Leap Year (ILY(date)) > . Next Working (Business) Date (DNW(date)) > . Next Weekend Date (DWE(date)) > > For a sample application to demonstrate the use of these new date > functions, take a look at the following: > > 2008 SAT Sample Applications: http://www.rupdates.com/sat2008/ > > -- R:BASE 7.6 for Windows: > Folder: C:\RBTI\2008_RBG76_SAT\NewDATEFunctions > Database: NDateFun > Command File: NewDATEFunctions.DAT > > -- R:BASE Turbo V-8 for Windows: > Folder: C:\RBTI\2008_RBG8_SAT\NewDATEFunctions > Database: NDateFun > Command File: NewDATEFunctions.DAT > > Have fun! > > Very Best R:egards, > > Razzak. > > >

