

1  DEF FN Tage(Kalenderdatum$)
2  3  LOCAL Tag,Monat,Jahr,I,Mt,Rest
4  RESTORE Mt
5  Rest=0
6  Tag= VAL( MID$(Kalenderdatum$,1,2))
7  Monat= VAL( MID$(Kalenderdatum$,4,2))
8  IF Monat>12 THEN
9     Monat=Monat MOD 12
10 ENDIF
11 IF VAL( MID$(Kalenderdatum$,7,2))<91 THEN
12    Jahr=2000+ VAL( MID$(Kalenderdatum$,7,2))
13 ELSE
14    Jahr=1900+ VAL( MID$(Kalenderdatum$,7,2))
15 ENDIF
16 FOR I=1 TO Monat-1
17    READ Mt
18    Rest=Rest+Mt
19    IF I=2 THEN
20       IF (Jahr MOD 4=0 AND Jahr MOD 100<>0) OR (Jahr MOD 400=0) THEN
21          Rest=Rest+1
22       ENDIF
23    ENDIF
24 NEXT I
25 Rest=Rest+Tag
26 FOR I=1991 TO Jahr-1
27    IF (I MOD 4=0 AND I MOD 100<>0) OR (I MOD 400=0) THEN
28       Rest=Rest+366
29    ELSE
30       Rest=Rest+365
31    ENDIF
32 NEXT I
33 Rest=Rest-1
34 RETURN Rest
35-Mt
36 DATA 31,28,31,30,31,30,31,31,30,31,30,31
37 END_FN
