Calendar: Difference between revisions

1,453 bytes added ,  12 years ago
(Updated D entry)
Line 1,397:
 
The output in 80 columns is similar, except that there are only three months per row, and the "[Snoopy]" and "1969" are centered above February.
 
=={{header|Run BASIC}}==
<lang runbasic>input "Gimme a year";yr
cls ' clear screen
mths$ = "January,February,March,April,May,June,July,August,September,October,November,December"
 
html "<table border=0 cellpadding=0 cellspacing=5><tr>"
html "<td colspan=3 align=center> <h3>Year:";yr;"</td></tr><tr>"
 
for mm = 1 to 12
gosub [getMonthInfo]
x = 0
if (mm - 1) mod 4 = 0 then html "</tr><tr>" ' 4 months across
html "<td valign=top><TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0><TR>"
html "<TD colspan=7 align=center bgcolor=wheat>"
html " ";word$(mths$,mm,",")
html "</TD><TR align=center bgcolor=wheat><TD>Sun<TD>Mon<TD>Tue<TD>Wed<TD>Thr<TD>Fri<TD>Sat<TR align=center>"
 
for i = 1 to mmDays + dow
if i > dow then x = x + 1
if x = 0 then html "<td></td>" else html "<TD>";x;"</TD>"
if (i mod 7) = 0 then html "</TR><TR align=center>"
next i
html "</TR></table></td>"
 
next mm
html "</table>"
wait
 
[getMonthInfo]
' ----------------------------------------
' day of week when month begins.
' days in a month
' ----------------------------------------
if yr < 100 then yr = val(date$("yy"))
if mm < 1 or mm > 12 then mm = val(date$("mm"))
dayOne$ = mm;"-01-";yr
n = date$(dayOne$)
dow = 1 + (n Mod 7) ' Day of Week month begins
m1 = mm
n1 = n + 27
while m1 = mm
n1 = n1 + 1
n$ = date$(n1)
m1 = val(left$(n$,2))
wend
mmDays = n1 - n ' Days in Month
RETURN</lang>
 
=={{header|Seed7}}==
Anonymous user