Calendar: Difference between revisions
no edit summary
No edit summary |
|||
(24 intermediate revisions by 8 users not shown) | |||
Line 881:
<p>Hopper tiene una función que genera calendarios en español, y con un formato diferente al pedido.</p>
<p>El calendario generado en un array 2D como el que se muestra a continuación:</p>
<p>Línea de código:</p>
<pre>
Let ( calendario := Calendar(1,año,12) )
[ 1:8, 1:7 ] Cget 'calendario', Print this table
</
<
ENE, , , , , ,1969
Dom,Lun,Mar,Mie,Jue,Vie,Sab
Line 893 ⟶ 895:
26, 27, 28, 29, 30, 31,
, , , , , ,
</
<p>Son generados tantos calendarios como se pida, y de diferentes formas (lineales o radiales). El código a continuación debe reformatear el calendario antes de imprimirlo.</p>
<syntaxhighlight lang="txt">
Line 912 ⟶ 914:
Cls
Tok sep ("")
End
Subrutines
Define 'Dibuja calendario'
Locate (fila, columna) Just center (23, [ contador mes++ ] Cget 'meses')
Print it
++fila
Loc row (fila--) [ {i}Plus(1):{i}Plus(7), 1:7 ] Cget 'calendario'
Print this table
++contador columna
columna += 25
When( Equals (contador columna, 4) ) {
Set '1', Copy to 'contador columna',
Move to 'columna'
fila+=9
}
i+=8
Return
Define 'Imprime año'
Line 947 ⟶ 954:
{{out}}
<pre>
$ hopper jm/calendar.jambo 1969
1969
Line 1,366 ⟶ 1,374:
</pre>
=={{header|
==={{header|BaCon}}===
Choosing 132 character output.
<syntaxhighlight lang="freebasic">DECLARE month$[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }
Line 1,422 ⟶ 1,431:
28 29 30 31 25 26 27 28 29 30 31 29 30 27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
</pre>
=={{header|Batch File}}==
<syntaxhighlight lang="dos">::Calender Task from Rosetta Code Wiki
Line 1,779 ⟶ 1,789:
exit(1);
}</syntaxhighlight>
{{libheader|Gadget}}
{{trans|Amazing Hopper}}
<syntaxhighlight lang="c">
#include <gadget/gadget.h>
LIB_GADGET_START
void draw_calendar( RDS(char*,calendario), int year );
void print_calendar( RDS(char*,calendario) );
Main
Assert( Arg_count ==2, fail_arg );
Get_arg_int( year, 1 );
ACTUAL_LANG_DATE = EN; /* text in english */
New array calendario as string;
/* get full year:
112 = code for months after initial month.
1 = initial month
year = well... */
calendario = Calendar(calendario, 112, 1, year);
draw_calendar( SDS(calendario), year );
Free str array calendario;
Exception( fail_arg ){
Msg_yellow("Modo de uso:\n ./calendar <nYear>");
}
End
void draw_calendar( RDS( char*, calendario), int year )
{
int fila=4, columna=1, cnt_columna=1, cnt_mes=0, i=0;
Cls;
At 2,35; Print "%d", year;
while ( cnt_mes < 12 )
{
String month_name;
Stack {
Store ( month_name, Pad_c( Capital( Get_monthname(cnt_mes++) ),' ',23) );
} Stack_off;
At fila, columna; Print "%s", month_name;
Atrow ++fila;
Range for calendario [ i+1: 1: i+8, 0:1: Cols(calendario) ];
print_calendar( SDS(calendario) );
--fila;
++cnt_columna;
columna += 25;
When( cnt_columna == 4 ) {
cnt_columna = columna = 1;
fila+=9;
}
i+=8;
Free secure month_name;
}
Prnl;
}
void print_calendar( RDS(char*,calendario) )
{
int i,j;
int row = SCREEN_ROW;
Iterup( row, calendario, i)
{
Iterup( col, calendario, j)
{
Print "%*s", 3, $calendario[i,j];
}
Atrow ++row;
}
}
</syntaxhighlight>
{{out}}
<pre>
1969
January February March
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1
5 6 7 8 9 10 11 2 3 4 5 6 7 8 2 3 4 5 6 7 8
12 13 14 15 16 17 18 9 10 11 12 13 14 15 9 10 11 12 13 14 15
19 20 21 22 23 24 25 16 17 18 19 20 21 22 16 17 18 19 20 21 22
26 27 28 29 30 31 23 24 25 26 27 28 23 24 25 26 27 28 29
30 31
April May June
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 1 2 3 1 2 3 4 5 6 7
6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14
13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21
20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28
27 28 29 30 25 26 27 28 29 30 31 29 30
July August September
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 1 2 1 2 3 4 5 6
6 7 8 9 10 11 12 3 4 5 6 7 8 9 7 8 9 10 11 12 13
13 14 15 16 17 18 19 10 11 12 13 14 15 16 14 15 16 17 18 19 20
20 21 22 23 24 25 26 17 18 19 20 21 22 23 21 22 23 24 25 26 27
27 28 29 30 31 24 25 26 27 28 29 30 28 29 30
31
October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1 2 3 4 5 6
5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13
12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20
19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27
26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
30
</pre>
=={{header|C sharp|C#}}==
An attempt to abuse the DateTime class for all static information. In the event that the number of days and months changes, so long as the DateTime class is updated accordingly, this should still print properly. It also abuses iterators to allow for a concise month printing method, but with the ability to still print x months per line.
Line 2,846 ⟶ 2,984:
28 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
30</pre>
=={{header|EasyLang}}==
{{trans|AWK}}
<syntaxhighlight>
year = 1969
#
wkdays$ = "Su Mo Tu We Th Fr Sa"
pagewide = 80
blank$ = ""
month$[] = [ " January " " February " " March " " April " " May " " June " " July " " August " " September" " October " " November " " December " ]
days[] = [ 31 28 31 30 31 30 31 31 30 31 30 31 ]
#
func$ center txt$ .
h$ = substr blank$ 1 ((pagewide - len txt$) / 2)
return h$ & txt$ & h$
.
func$ makewk fst lst day .
for i to day - 1
wstr$ &= " "
.
for i = fst to lst
i$ = i
if i <= 9
i$ = " " & i
.
wstr$ &= i$ & " "
.
return substr wstr$ & blank$ 1 20
.
proc dow y . ndow leap .
leap = 0
if y mod 4 = 0
leap = 1
.
if y mod 100 = 0
leap = 0
.
if y mod 400 = 0
leap = 1
.
ndow = y * 365 + y div 4 - y div 100 + y div 400 + 1
ndow = (ndow - leap) mod1 7
.
len lin$[] 8
proc prmonth nmonth newdow monsize . .
lin$[1] &= " " & month$[nmonth] & " "
lin$[2] &= wkdays$ & " "
lin$[3] &= makewk 1 (8 - newdow) newdow & " "
for i = 4 to 7
lin$[i] &= makewk (9 + h - newdow) lower monsize (15 + h - newdow) 1 & " "
h += 7
.
lin$[8] &= makewk (37 - newdow) monsize 1 & " "
if len lin$[3] + 22 > pagewide
for i to 8
print center lin$[i]
lin$[i] = ""
.
.
.
for i to pagewide
blank$ &= " "
.
dow year newdow leap
print center "[ picture of Snoopy goes here ]"
print center year
for i = 1 to 12
monsize = days[i]
if i = 2 and leap = 1
monsize = 29
.
prmonth i newdow monsize
newdow = (monsize + newdow) mod1 7
.
</syntaxhighlight>
=={{header|F Sharp|F#}}==
<syntaxhighlight lang="fsharp">let getCalendar year =
Line 2,961 ⟶ 3,174:
30
"</pre>
=={{header|Factor}}==
<syntaxhighlight lang="factor">USING: arrays calendar.format grouping io.streams.string kernel
Line 3,011 ⟶ 3,225:
26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
30
</pre>
=={{header|Forth}}==
<syntaxhighlight lang="forth">
: weekday ( d m y -- u )
over 3 < if swap 12 + swap 1- then
dup 4 / over 100 / - over 400 / + + swap 1+ 13 * 5 / + + 2 - 7 mod ;
: mdays ( m y -- msize mday )
over 12 = if 31 1 2swap weekday negate exit then
2>r 1 2r@ weekday 1 2r> swap 1+ swap weekday over -
7 + 7 mod 28 + swap negate ;
: .week ( msize mday -- msize mday' )
7 0 do dup 0< if 1+ 3 spaces else
2dup > if 1+ dup 2 .r space else 3 spaces then then loop ;
: .3months ( y m -- )
3 0 do ." Mo Tu We Th Fr Sa Su " loop cr
3 over + swap do i over mdays rot loop drop
6 0 do 2rot .week 2 spaces 2rot .week 2 spaces 2rot .week cr loop
2drop 2drop 2drop ;
: cal ( y -- )
30 spaces ." [Snoopy]" cr
32 spaces dup . cr
." January February March" cr
dup 1 .3months
." April May June" cr
dup 4 .3months
." July August September" cr
dup 7 .3months
." October November December" cr
10 .3months ;
1969 cal
</syntaxhighlight>
{{out}}
<pre>
[Snoopy]
1969
January February March
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 3 4 5 1 2 1 2
6 7 8 9 10 11 12 3 4 5 6 7 8 9 3 4 5 6 7 8 9
13 14 15 16 17 18 19 10 11 12 13 14 15 16 10 11 12 13 14 15 16
20 21 22 23 24 25 26 17 18 19 20 21 22 23 17 18 19 20 21 22 23
27 28 29 30 31 24 25 26 27 28 24 25 26 27 28 29 30
31
April May June
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 3 4 5 6 1 2 3 4 1
7 8 9 10 11 12 13 5 6 7 8 9 10 11 2 3 4 5 6 7 8
14 15 16 17 18 19 20 12 13 14 15 16 17 18 9 10 11 12 13 14 15
21 22 23 24 25 26 27 19 20 21 22 23 24 25 16 17 18 19 20 21 22
28 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29
30
July August September
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 3 4 5 6 1 2 3 1 2 3 4 5 6 7
7 8 9 10 11 12 13 4 5 6 7 8 9 10 8 9 10 11 12 13 14
14 15 16 17 18 19 20 11 12 13 14 15 16 17 15 16 17 18 19 20 21
21 22 23 24 25 26 27 18 19 20 21 22 23 24 22 23 24 25 26 27 28
28 29 30 31 25 26 27 28 29 30 31 29 30
October November December
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 3 4 5 1 2 1 2 3 4 5 6 7
6 7 8 9 10 11 12 3 4 5 6 7 8 9 8 9 10 11 12 13 14
13 14 15 16 17 18 19 10 11 12 13 14 15 16 15 16 17 18 19 20 21
20 21 22 23 24 25 26 17 18 19 20 21 22 23 22 23 24 25 26 27 28
27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
</pre>
=={{header|Fortran}}==
Line 4,349 ⟶ 4,634:
30
</pre>
=={{header|jq}}==
'''Adapted from [[#Wren|Wren]]'''
{{works with|jq}}
'''Also works with gojq, the Go implementation of jq'''
'''Also works with fq, a Go implementation of a large subset of jq'''
'''Utility Functions'''
<syntaxhighlight lang=jq>
def nwise($n):
def n: if length <= $n then . else .[0:$n] , (.[$n:] | n) end;
n;
def lpad($len): tostring | ($len - length) as $l | (" " * $l)[:$l] + .;
def center(width):
tostring
| length as $l
| ((width - $l)/2 | floor) as $k
| (" " * $k) + . + (" " * (width - ($k+$l)));
</syntaxhighlight>
'''Calendrical Functions'''
<syntaxhighlight lang=jq>
def weekdaynames: ["Su", "Mo","Tu", "We", "Th", "Fr", "Sa"];
# q.v. weekday
# Output the integer index of weekdaynames, i.e. Sunday is 0
def dayofweek($year; $month; $day):
"\($year)-\($month)-\($day)" | strptime("%Y-%m-%d") | .[-2];
def isLeapYear(y):
y%4 == 0 and ((y%100 != 0) or (y%400 == 0));
# January is 1
def monthLength($y; $m):
def __diy: [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365];
def __diy2: [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366];
if isLeapYear($y)
then __diy2[$m] - __diy2[$m-1]
else __diy[$m] - __diy[$m-1]
end;
def calendar(year):
def snoopy: "🐶";
def months: [
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" ];
(weekdaynames | join(" ")) as $days
# $chunk is a list of three months in group number $c
| def printRow($chunk; $c):
# The line of month names:
(" " + ($chunk | map(center(20)) | join(" "))),
# The line of weekday names
(" " + ([range(0;3)| $days] | join(" "))),
# The body of the calendar
( [ dayofweek(year; $c*3 + 1; 1),
dayofweek(year; $c*3 + 2; 1),
dayofweek(year; $c*3 + 3; 1)] as $first
| [ monthLength(year; $c*3 + 1),
monthLength(year; $c*3 + 2),
monthLength(year; $c*3 + 3) ] as $mlen
# Print up to 6 lines
| range(0;6) as $i
| reduce range(0;3) as $j ("";
(1 + (7 * $i) - $first[$j]) as $start
| (reduce range($start; $start+7) as $k (.;
if ($k >= 1 and $k <= $mlen[$j])
then . + ($k|lpad(3))
else . + " "
end ) + " " ) )
),
"";
(snoopy, "--- \(year) ---" | center(72)),
( [months|nwise(3)] as $chunks
| range(0;3) | printRow( $chunks[.]; .) );
calendar(1969)
</syntaxhighlight>
{{output}}
As for [[#Wren|Wren]].
=={{header|Julia}}==
<syntaxhighlight lang="julia">
Line 4,416 ⟶ 4,784:
lineprintcalendar(1969)
</syntaxhighlight>
=={{header|Kotlin}}==
{{trans|D}}
Line 5,768 ⟶ 6,137:
=={{header|Phix}}==
Gregorian calender only.
<!--
<syntaxhighlight lang="phix">
with javascript_semantics
constant year = 1969
include builtins\timedate.e
function centre(string s, integer width)
integer gap = width-length(s),
left = floor(gap/2),
right = gap-left
return repeat(' ',left) & s & repeat(' ',right)
end function
function one_month(integer year, integer month, bool sun_to_sat)
string weekdays = iff(sun_to_sat?"Su Mo Tu We Th Fr Sa"
:"Mo Tu We Th Fr Sa Su"),
line = repeat(' ',20)
sequence ldm = adjust_timedate(iff(month=12?{year+1,1,1,0,0,0,0,0}
:{year,month+1,1,0,0,0,0,0}),
timedelta(days:=-1)),
res = {centre(format_timedate(ldm,"Mmmm"),20),weekdays}
integer dow = day_of_week(year,month,1)
if sun_to_sat then dow = remainder(dow,7)+1 end if
integer lastday = ldm[DT_DAY],
p = dow*3-2
for d=1 to lastday do
line[p..p+1] = sprintf("%2d",d)
p += 3
if dow=7 or d=lastday then
res = append(res,line)
line = repeat(' ',20)
dow = 1
else
dow += 1
end if
end for
return res
end function
procedure print_calendar(integer year, width, bool sun_to_sat=false)
sequence months = repeat(0,12)
integer wide = floor((width+2)/22)
printf(1,centre("[Spot Reserved For Snoopy]",width)&"\n")
printf(1,centre(sprintf("%d",year),width)&"\n")
for month=1 to 12 do
months[month] = one_month(year,month,sun_to_sat)
end for
for month=1 to 12 by wide do
for k=1 to 9 do -- (more than enough)
integer any = 0
string line = ""
for j=0 to wide-1 do
if length(line) then
end if
if k>length(months[month+j]) then
else
line &= months[month+j][k]
end for
if any=0 then exit end if
printf(1,centre(line,width)&"\n")
end for
end for
end procedure
print_calendar(year,80)
printf(1,join(repeat("1234567890",8),"")&"\n")
print_calendar(year,132,true)
printf(1,join(repeat("1234567890",13),"")&"12\n")
</syntaxhighlight>
{{out}}
<pre style="font-size:75%">
[Spot Reserved For Snoopy]
1969
Line 5,897 ⟶ 6,267:
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
</pre>
=={{header|Phixmonti}}==
{{trans|Lua}}
Line 6,579 ⟶ 6,950:
20 21 22 23 24 25 26 17 18 19 20 21 22 23 22 23 24 25 26 27 28
27 28 29 30 31 24 25 26 27 28 29 30 29 30 31</syntaxhighlight>
=={{header|R}}==
<syntaxhighlight lang="R">
library(lubridate)
library(stringi)
# Helper function padding
pad_d <- function(gr) gr %>% stri_pad_left(2) %>% stri_c(collapse = " ")
pad_l <- function(gr) gr %>% pad_d() %>% stri_pad_left(20)
pad_r <- function(gr) gr %>% pad_d() %>% stri_pad_right(20)
pad_20 <- " " %s*% 20
# 1st week mapping
idx_week <- list("1"=1,"7"=2,"6"=3,"5"=4,"4"=5,"3"=6,"2"=7)
# Generate a single month
gen_cal <- function(date_str) {
str_l <- list()
# Pick up month name
month_name <- month(ymd(date_str),label = T,abbr = F) %>%
as.character() %>%
stri_pad_both(20)
# Add to list with day header
str_l[length(str_l)+1] <- month_name
str_l[length(str_l)+1] <- "Mo Tu We Th Fr Sa Su"
# Day list for the month
cc <- 1:days_in_month(as.Date(date_str))
# Staring week
wd <- wday(ymd(date_str))
st <- idx_week[as.character(wd)][[1]]
# Add 1st week
str_l[length(str_l)+1] <- pad_l(head(cc,st))
# Middle weeks
cc <- tail(cc,-st)
while (length(cc) > 7) {
str_l[length(str_l)+1] <- pad_l(head(cc,7))
cc <- tail(cc,-7)
}
# Last week
str_l[length(str_l)+1] <- pad_r(cc)
# Pad for empty week
if (length(str_l)==7)
str_l[length(str_l)+1] <- pad_20
str_l
}
# Print calendar
print_calendar <- function(target_year) {
cat("\n",stri_pad_both(target_year,64),"\n\n")
for (j in seq.int(1,12,3)) {
cal <- sapply(j:(j+2),\(x) gen_cal(paste0(target_year,"/",x,"/1")))
xres <- paste(cal[,1],cal[,2],cal[,3],sep = " ")
for (i in xres) cat(i,"\n")
}
}
#
# Main
#
print_calendar("1969")
</syntaxhighlight>
{{out}}
<pre>
1969
January February March
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 3 4 5 1 2 1 2
6 7 8 9 10 11 12 3 4 5 6 7 8 9 3 4 5 6 7 8 9
13 14 15 16 17 18 19 10 11 12 13 14 15 16 10 11 12 13 14 15 16
20 21 22 23 24 25 26 17 18 19 20 21 22 23 17 18 19 20 21 22 23
27 28 29 30 31 24 25 26 27 28 24 25 26 27 28 29 30
31
April May June
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 3 4 5 6 1 2 3 4 1
7 8 9 10 11 12 13 5 6 7 8 9 10 11 2 3 4 5 6 7 8
14 15 16 17 18 19 20 12 13 14 15 16 17 18 9 10 11 12 13 14 15
21 22 23 24 25 26 27 19 20 21 22 23 24 25 16 17 18 19 20 21 22
28 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29
30
July August September
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 3 4 5 6 1 2 3 1 2 3 4 5 6 7
7 8 9 10 11 12 13 4 5 6 7 8 9 10 8 9 10 11 12 13 14
14 15 16 17 18 19 20 11 12 13 14 15 16 17 15 16 17 18 19 20 21
21 22 23 24 25 26 27 18 19 20 21 22 23 24 22 23 24 25 26 27 28
28 29 30 31 25 26 27 28 29 30 31 29 30
October November December
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 3 4 5 1 2 1 2 3 4 5 6 7
6 7 8 9 10 11 12 3 4 5 6 7 8 9 8 9 10 11 12 13 14
13 14 15 16 17 18 19 10 11 12 13 14 15 16 15 16 17 18 19 20 21
20 21 22 23 24 25 26 17 18 19 20 21 22 23 22 23 24 25 26 27 28
27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
</pre>
=={{header|Racket}}==
<syntaxhighlight lang="racket">#lang racket
Line 7,155 ⟶ 7,635:
[https://www.dropbox.com/s/sj37yypiq45o5cd/CalmoSoftCalendar.jpg?dl=0 Calendar]
=={{header|RPL}}==
Screens of calculators running RPL have a maximum of 7 lines and 22 columns, so we can only display one month at a time.
<code>WKDAY</code> is defined at [[Last Friday of each month#RPL|Last Friday of each month]]
[[File:RPL Calendar.png|thumb|Screenshot of a HP-48 emulator]]
{{works with|HP|48}}
« FP DUP 2 TRNC 1 → month line
« CLLCD "Mo Tu We Th Fr Sa Su" 1 DISP
1 + DUP <span style="color:blue">WKDAY</span> 1 - NEG DATE+
'''DO''' ""
1 7 '''START'''
OVER FP 2 TRNC month ==
" " 4 PICK IP →STR + DUP SIZE DUP 1 -
SWAP SUB " " IFTE + " " +
SWAP 1 DATE+ SWAP
'''NEXT'''
'line' INCR DISP
'''UNTIL''' DUP FP 2 TRNC month ≠ '''END'''
7 FREEZE
» » ‘<span style="color:blue">CAL</span>’ STO
1.072023 <span style="color:blue">CAL</span>
=={{header|Ruby}}==
<code>Date</code> class, from the standard library, knows how many days in a month, and which day is Sunday, for both Julian and Gregorian calendars. This program uses <code>Date</code> class, plus its own assumptions, to create the calendar. This program assumes that every year has 12 months and starts with January 1, and every month fits in 6 weeks starting with Sunday.
Line 7,287 ⟶ 7,790:
31
</pre>
=={{header|Rust}}==
<syntaxhighlight lang="rust">// Assume your binary name is 'calendar'.
Line 9,711 ⟶ 10,215:
{{libheader|Wren-fmt}}
{{libheader|Wren-seq}}
<syntaxhighlight lang="
import "./fmt" for Fmt
import "./seq" for Lst
var calendar = Fn.new { |year|
Line 9,801 ⟶ 10,305:
30
</pre>
=={{header|WYLBUR}}==
|