Day of the week: Difference between revisions
Content deleted Content added
perl |
Updated task description and Java, UNIX Shell needs code and output update |
||
Line 2: | Line 2: | ||
A company decides that whenever Xmas falls on a Sunday that they will give their workers all extra paid holidays so that, together with any public holidays, workers will not have to work the following week (between the 25th of December and the first of January). |
A company decides that whenever Xmas falls on a Sunday that they will give their workers all extra paid holidays so that, together with any public holidays, workers will not have to work the following week (between the 25th of December and the first of January). |
||
'''In what years between 2008 and |
'''In what years between 2008 and 2121 will the 25th of December be a Sunday?''' |
||
Using any standard date handling libraries of your programming language; compare the dates calculated with the output of other languages to discover any anomalies in the handling of dates which may be due to, for example, overflow in types used to represent dates/times similar to [[wp:Y2k#See_also|y2k]] problems. |
Using any standard date handling libraries of your programming language; compare the dates calculated with the output of other languages to discover any anomalies in the handling of dates which may be due to, for example, overflow in types used to represent dates/times similar to [[wp:Y2k#See_also|y2k]] problems. |
||
Line 88: | Line 88: | ||
public class Yuletide{ |
public class Yuletide{ |
||
public static void main(String[] args) { |
public static void main(String[] args) { |
||
for(int i = 2008;i<= |
for(int i = 2008;i<=2121;i++){ |
||
GregorianCalendar cal = new GregorianCalendar(i, Calendar.DECEMBER, |
GregorianCalendar cal = new GregorianCalendar(i, Calendar.DECEMBER, |
||
25); |
25); |
||
Line 110: | Line 110: | ||
Sun Dec 25 00:00:00 CST 2078 |
Sun Dec 25 00:00:00 CST 2078 |
||
Sun Dec 25 00:00:00 CST 2089 |
Sun Dec 25 00:00:00 CST 2089 |
||
Sun Dec 25 00:00:00 CST 2095 |
Sun Dec 25 00:00:00 CST 2095 |
||
Sun Dec 25 00:00:00 CST 2101 |
|||
Sun Dec 25 00:00:00 CST 2107 |
|||
Sun Dec 25 00:00:00 CST 2112 |
|||
Sun Dec 25 00:00:00 CST 2118</pre> |
|||
=={{header|Objective-C}}== |
=={{header|Objective-C}}== |
||
Line 231: | Line 235: | ||
=={{header|UNIX Shell}}== |
=={{header|UNIX Shell}}== |
||
{{incorrect|UNIX Shell}} |
|||
{{works with|bash}} |
{{works with|bash}} |
||