Time and date functions¶
The following functions operate on the built-in type DateTime
for timestamps.
DateTime::addSeconds : DateTime -> Int -> DateTime
¶
The function DateTime::addSeconds
adds seconds to a timestamp.
Examples¶
val a = DateTime::addSeconds #2017-12-24T13:37:00Z# 60
// = #2017-12-24T13:38:00Z#
DateTime::addDays : DateTime -> Int -> DateTime
¶
Add days to a timestamp.
Examples¶
val now = #2018-02-08T10:00:00Z#
val tomorrow = DateTime::addDays now 1
// = #2018-02-09T10:00:00Z#
val yesterday = DateTime::addDays now (0 - 1)
// = #2018-02-07T10:00:00Z#
DateTime::Components
¶
The type DateTime::Components
represents the components of a DateTime
value, e.g., year, month, etc.
The DateTime::Components
is a built-in type.
The definition is
module DateTime {
type Components {
year : Int,
month : Int,
day : Int,
hour : Int,
minute : Int,
second : Int
}
}
DateTime::components : DateTime -> DateTime::Components
¶
Extract a DateTime::Components
representation from a DateTime
value.
Examples¶
val a = DateTime::components #2018-02-08T10:15:30Z#
// = DateTime::Components {
// year = 2018,
// month = 2,
// day = 8,
// hour = 10,
// minute = 15,
// second = 30
// }
DateTime::DayOfWeek
¶
The built-in type DateTime::DayOfWeek
represents the days of the week.
Its definition is
module DateTime {
type DayOfWeek
| Monday
| Tuesday
| Wednesday
| Thursday
| Friday
| Saturday
| Sunday
}