cal by murky-satyr

c=Calendar.instance
n='\n'
System.in.eachLine{(m,y)=it.split()*.toShort()
c.set(y-1900,m-1,1)
i=(c.get(7)+2)%7
o=sprintf('%tB '+y,c).center(20)+'\nSu Mo Tu We Th Fr Sa'+(i?n+' '*(3*i-1):'')
1.upto(c.getActualMaximum(5)){j->o+=(i++%7?' ':n)+(j>9?j:' '+j)}
println i<36?o+n:o}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page