Have a Question?
Print

00732: Sample program to convert a Julian date to the numeric week of a year

Title:

Sample program to convert a Julian date to the numeric week of a year

Description:

The following User Defined Function will convert a Julian number to a Day of the Week: 


0200 REM “simply say which 7 day group, 1 based” 
0210 DEF FNWEEK(X)=INT((X-JUL(NUM(DATE(X:”%Yl”)),1,1))/7)+1 
0220 REM “for a calendar week” 
0230 DEF FNCALENDAR(X) 
0240 LET FIRST_OF_YEAR=JUL(NUM(DATE(X:”%Yl”)),1,1) 
0250 LET DAY_OF_WEEK=(POS(CVS(DATE(FIRST_OF_YEAR:”%Ds”),4)= 
“SATFRITHUWEDTUEMONSUN”,3)+2)/3 
0260 IF X-FIRST_OF_YEAR-DAY_OF_WEEK<0 THEN LET WEEK=0 
ELSE LET WEEK=1+INT((X-FIRST_OF_YEAR-DAY_OF_WEEK)/7) 
0270 LET WEEK=WEEK+1 
0280 RETURN WEEK 
0290 FNEND 



Last Modified: 06/01/1999 Product: PRO/5 Operating System: N/A

BASIS structures five components of their technology into the BBx Generations.

Table of Contents
Scroll to Top