Skip to content

Instantly share code, notes, and snippets.

@aliyome
Last active July 22, 2018 06:27
Show Gist options
  • Select an option

  • Save aliyome/3acb9ca5141d39a8bb16 to your computer and use it in GitHub Desktop.

Select an option

Save aliyome/3acb9ca5141d39a8bb16 to your computer and use it in GitHub Desktop.
import std.stdio, std.datetime, std.conv;
void main() {
auto t = Clock.currTime();
auto c = t.endOfMonth.day;
auto o = new Date(t.year, t.month, 1).dayOfWeek.to!int;
foreach (i; 0 .. o) {
write(" ");
}
foreach (i; 1 .. c + 1) {
writef("%2d", i);
write((i + o) % 7 == 0 ? "\n" : " ");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment