on 727d708 help sign in
elk/libraries/Date.elm
50 lines 1.7 kB history raw
2-- Library for working with dates. It is still a work in progress, so email
3-- the mailing list if you are having issues with internationalization or
4-- locale formatting or something.
5module Date where
7-- Represents the days of the week.
8data Day = Mon | Tue | Wed | Thu | Fri | Sat | Sun
10-- Represents the month of the year.
11data Month = Jan | Feb | Mar | Apr
12 | May | Jun | Jul | Aug
13 | Sep | Oct | Nov | Dec
15-- Attempt to read a date from a string.
16read : String -> Maybe Date
18-- Convert a date into a time since midnight (UTC) of 1 January 1990 (i.e.
19-- [UNIX time](http://en.wikipedia.org/wiki/Unix_time)). Given the date 23 June
20-- 1990 at 11:45AM this returns the corresponding time.
21toTime : Date -> Time
23-- Extract the year of a given date. Given the date 23 June 1990 at 11:45AM
24-- this returns the integer `1990`.
25year : Date -> Int
27-- Extract the month of a given date. Given the date 23 June 1990 at 11:45AM
28-- this returns the Month `Jun` as defined below.
29month : Date -> Month
32-- Extract the day of a given date. Given the date 23 June 1990 at 11:45AM
33-- this returns the integer `23`.
34day : Date -> Int
36-- Extract the day of the week for a given date. Given the date 23 June
37-- 1990 at 11:45AM this returns the Day `Thu` as defined below.
38dayOfWeek : Date -> Day
40-- Extract the hour of a given date. Given the date 23 June 1990 at 11:45AM
41-- this returns the integer `11`.
42hour : Date -> Int
44-- Extract the minute of a given date. Given the date 23 June 1990 at 11:45AM
45-- this returns the integer `45`.
46minute : Date -> Int
48-- Extract the second of a given date. Given the date 23 June 1990 at 11:45AM
49-- this returns the integer `0`.
50second : Date -> Int