Howzit Bjorn
Here is my program to do it:
Louie
*----------------------
PROMPT ''
10*
CRT 'Date to calc week number for : ':;INPUT DATE.INPUT ;* e.g 13/05/2005
IF DATE.INPUT='' THEN STOP
*--
IDATE = ICONV(DATE.INPUT,'D')
YEAR=OCONV(IDATE,'DY')
MY.JULIAN.DATE=OCONV(IDATE,'DJ')
*--
WEEK.NO=0
FIRST.DAY=0
GOSUB FIND.FIRST.DAY
*--
GOSUB GET.WEEK.NO
*--
CRT WEEK.NO ;* the week number for the date typed in
*-- check next date
GOTO 10
*--
FIND.FIRST.DAY:
*-- find the first sunday of the year in question
*-- normally week number 1 start on that Sunday
FOUND=0
FOR I=1 TO 8 WHILE NOT(FOUND)
TDATE=I:'/01/':YEAR ;* south african date style - dd/mm/yyy
ITDATE=ICONV(TDATE,'D')
TDATEDAY = OCONV(ITDATE,'DWA')
IF TDATEDAY='SUNDAY' THEN
FOUND=1
FIRST.DAY=I
END
NEXT I
RETURN
*--
GET.WEEK.NO:
*--
FOR IDAY = 1 TO MY.JULIAN.DATE
C=MOD(IDAY-FIRST.DAY,7)
IF C=0 THEN WEEK.NO=WEEK.NO+1
NEXT I
RETURN
*---------------------------------------
>Does anybody know how to work out what week of the year you are in?
Regards
Bjorn
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/