Anonymous user
Day of the week: Difference between revisions
m
Fixed tags
m (Fixed tags) |
|||
Line 270:
{{works with|Fortran|90 and later}}
Based on Forth example
Output
25th of December is a Sunday in 2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118
Line 313:
=={{header|Haskell}}==
Using the time library:
<lang haskell>import Data.Time▼
▲import Data.Time
import Data.Time.Calendar.WeekDate
Line 321 ⟶ 320:
main = mapM_ putStrLn ["25 December " ++ show year ++ " is Sunday"
| year <- [2008..2121], isXmasSunday year]</lang>
Output:
<pre>
Line 345 ⟶ 343:
The built-in System.Time module overflows at the Unix epoch in 2038:
<lang haskell>import System.Time▼
▲import System.Time
isXmasSunday year = ctWDay cal == Sunday
Line 366 ⟶ 363:
main = mapM_ putStrLn ["25 December " ++ show year ++ " is Sunday"
| year <- [2008..2121], isXmasSunday year]</lang>
Output on 32-bit machine:
<pre>
Line 424 ⟶ 420:
Consequently, it suffers from the same problem as C.
<lang modula3>MODULE Yule EXPORTS Main;▼
▲MODULE Yule EXPORTS Main;
IMPORT IO, Fmt, Date, Time;
Line 452 ⟶ 447:
END;
END;
END Yule.</lang>
Output:
|