Calendar: Difference between revisions
Content deleted Content added
→{{header|C}}: -trailing spaces |
→{{header|Ruby}}: Need 1.8.7 |
||
Line 907: | Line 907: | ||
<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. |
<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. |
||
* This program requires Ruby 1.8.7 because it calls Array#each_slice. |
|||
{{works with|Ruby|1.8.7}} |
|||
<lang ruby>require 'date' |
<lang ruby>require 'date' |
||