Date

type Date
Representation of a date.

now : Task x Date
Get the Date at the moment when this task is run.

Conversions fromString : String -> Result String Date
Attempt to read a date from a string.

toTime : Date -> Time
Convert a Date to a time in milliseconds.

A time is the number of milliseconds since the Unix epoch.

fromTime : Time -> Date
Convert a time in milliseconds into a Date.

A time is the number of milliseconds since the Unix epoch.

Extractions year : Date -> Int
Extract the year of a given date. Given the date 23 June 1990 at 11:45AM this returns the integer 1990.

month : Date -> Month
Extract the month of a given date. Given the date 23 June 1990 at 11:45AM this returns the month Jun as defined below.


type Month
    = Jan
    | Feb
    | Mar
    | Apr
    | May
    | Jun
    | Jul
    | Aug
    | Sep
    | Oct
    | Nov
    | Dec

Represents the month of the year.

day : Date -> Int
Extract the day of a given date. Given the date 23 June 1990 at 11:45AM this returns the integer 23.

dayOfWeek : Date -> Day
Extract the day of the week for a given date. Given the date 23 June 1990 at 11:45AM this returns the day Sat as defined below.


  type Day
  = Mon
  | Tue
  | Wed
  | Thu
  | Fri
  | Sat
  | Sun
> Represents the days of the week.

hour : Date -> Int
Extract the hour of a given date. Given the date 23 June 1990 at 11:45AM this returns the integer 11.

minute : Date -> Int
Extract the minute of a given date. Given the date 23 June 1990 at 11:45AM this returns the integer 45.

second : Date -> Int
Extract the second of a given date. Given the date 23 June 1990 at 11:45AM this returns the integer 0.

millisecond : Date -> Int
Extract the millisecond of a given date. Given the date 23 June 1990 at 11:45:30.123AM this returns the integer 123.