Day of the week: Difference between revisions
Content deleted Content added
→{{header|UNIX Shell}}: It is correct in that it shows a limitation |
php |
||
Line 204: | Line 204: | ||
I suppose there's a CPAN package that handles dates without relying on hardware/implementation dependent sizes (the Perl code basically seems to use the same functions used by C code) |
I suppose there's a CPAN package that handles dates without relying on hardware/implementation dependent sizes (the Perl code basically seems to use the same functions used by C code) |
||
=={{header|PHP}}== |
|||
<php><?php |
|||
for($i=2008; $i<2121; $i++) |
|||
{ |
|||
$datetime = new DateTime("$i-12-25 00:00:00"); |
|||
if ( $datetime->format("w") == 0 ) |
|||
{ |
|||
echo "25 Dec $i is Sunday\n"; |
|||
} |
|||
} |
|||
?> |
|||
</php> |
|||
Output: |
|||
<pre> |
|||
25 Dec 2011 is Sunday |
|||
25 Dec 2016 is Sunday |
|||
25 Dec 2022 is Sunday |
|||
25 Dec 2033 is Sunday |
|||
25 Dec 2039 is Sunday |
|||
25 Dec 2044 is Sunday |
|||
25 Dec 2050 is Sunday |
|||
25 Dec 2061 is Sunday |
|||
25 Dec 2067 is Sunday |
|||
25 Dec 2072 is Sunday |
|||
25 Dec 2078 is Sunday |
|||
25 Dec 2089 is Sunday |
|||
25 Dec 2095 is Sunday |
|||
25 Dec 2101 is Sunday |
|||
25 Dec 2107 is Sunday |
|||
25 Dec 2112 is Sunday |
|||
25 Dec 2118 is Sunday |
|||
</pre> |
|||
=={{header|Python}}== |
=={{header|Python}}== |