67 lines
2.2 KiB
Text
67 lines
2.2 KiB
Text
Module Calendar (Year, LocaleId) {
|
|
Function GetMax(Year, Month) {
|
|
a=date(str$(Year)+"-"+str$(Month)+"-1")
|
|
max=32
|
|
do {
|
|
max--
|
|
m=val(str$(cdate(a,0,0,max), "m"))
|
|
} until m=Month
|
|
=max+1
|
|
}
|
|
Function SkipMo(Year, Month) {
|
|
a=date(str$(Year)+"-"+str$(Month)+"-1")
|
|
=(val(str$(a, "w"))-8) mod 7 +7
|
|
}
|
|
Function Title$(a$) {
|
|
=Ucase$(left$(a$,1))+Lcase$(Mid$(a$, 2))
|
|
}
|
|
locale LocaleId
|
|
Cursor 0,Height-1 ' last line, so each new line scroll all lines up
|
|
Print Over $(2), Year
|
|
Print
|
|
For j=0 to 3 {
|
|
Print
|
|
For i=1 to 3 {
|
|
Month=i+j*3
|
|
Print Part @((i-1)*29-1), $(2,22), Title$(Ucase$(locale$(55+Month)))
|
|
}
|
|
Print
|
|
Dim Skip(1 to 3), Count(1 to 3), D(1 to 3)=1
|
|
For i=1 to 3 {
|
|
Month=i+j*3
|
|
if i>1 Then Print String$(" ",8);
|
|
For k=42 to 48 :Print Title$(Ucase$(Left$(locale$(k),2)));" ";:Next k
|
|
Skip(i)=SkipMo(Year, Month)
|
|
Count(i)=GetMax(Year, Month)
|
|
}
|
|
Print
|
|
For i=1 to 3 {
|
|
if i>1 Then Print String$(" ",8);
|
|
For k=1 to 7 {
|
|
skip(i)--
|
|
if skip(i)>0 Then Print " "; :continue
|
|
Count(i)--
|
|
Print format$("{0::-2} ", d(i));
|
|
d(i)++
|
|
}
|
|
}
|
|
Print
|
|
Print @(0)
|
|
For m=1 to 5 {
|
|
For i=1 to 3 {
|
|
if i>1 Then Print String$(" ",8);
|
|
For k=1 to 7 {
|
|
Count(i)--
|
|
if Count(i)<0 Then Print " "; : Continue
|
|
Print format$("{0::-2} ", d(i));
|
|
d(i)++
|
|
}
|
|
}
|
|
Print
|
|
}
|
|
}
|
|
}
|
|
Form 80,43
|
|
Calendar 1969, 1033 ' English
|
|
k=Key$ ' wait key
|
|
Calendar 2018, 1032 ' Greek
|