Deduce length of a (calendar) quarter from integer?

H

Henrootje

TblROSR <- the table
================
ROSR_QuarterNumber numeric 'contains the number that defines the
quarter
ROSR_QuarterLength numeric 'should contain the length in days of
the quarter


During the import of some textfile with data my users have to input a
number that defines the quarter (ROSR_QuarterNumber);
EG: if they import a file with data from the fourth quarter of 2005
they will enter:
54 (5, being the year 2005, 4 being the fourth quarter) (1-10-2005 /
31-12-2005)
61 (6, being the year 2006, 1 being the first quarter) (1-1-2006 /
31-3-2006)

This value is stored in a numeric field in the table TblROSR (Integer)

Now I need to calculate the length (in calenderdays) of the
quarterTblROSR <- the table
================
ROSR_QuarterNumber numeric 'contains the number that defines the
quarter
ROSR_QuarterLength numeric 'should contain the length in days of
the quarter


During the import of some textfile with data my users have to input a
number that denotes the quarter (ROSR_QuarterNumber)
EG: if they import a file with data from the fourth quarter of 2005
they will enter:
54 (5, being the year 2005, 4 being the fourth quarter)
(1-10-2005 / 31-12-2005)
61 (6, being the year 2006, 1 being the first quarter)
(1-1-2006 / 31-3-2006)

This value is stored in a numeric field in the table TblROSR

Now I need to calculate the length (in calenderdays) of the quarter and
fill the field ROSR_QuarterLength with it.

Any suggestions as to how this best can be done?

TIA,

Henro
Any suggestions as to how this best can be done?

TIA,

Henro
 
R

Ron2005

Quarter 2 is always 91 days
Quarter 3 is always 92 days
quarter 4 is always 92 days

because of a possible leap year
for quarter 1 use datediff with 01/01 & year as from date and 03/31 &
year as the to date.
 
R

Ron2005

double check that datediff formula, you may have to add 1 to the
computation since date diff doesn't count the first day.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top