Created
October 28, 2014 06:28
-
-
Save 3846masa/23a95b04f7b16cdb9fbb to your computer and use it in GitHub Desktop.
ceylonでカレンダー
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@3846masa | |
import ceylon.time { now, date, Date } | |
void run() { | |
Date today = now().date(); | |
Integer start_wday = date(today.year, today.month, 1).dayOfWeek.integer; | |
Integer all_days = today.month.numberOfDays(); | |
for (day in (1 - start_wday)..all_days) { | |
String day_str = (day <= 0) then "" else day.string; | |
process.write(day_str.padLeading(2)); | |
String pad = ((day + start_wday) % 7 == 0) then "\n" else " "; | |
process.write(pad); | |
} | |
process.write("\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment