birl/time
Types
pub type Month {
January
February
March
April
May
June
July
August
September
October
November
December
}
Constructors
-
January
-
February
-
March
-
April
-
May
-
June
-
July
-
August
-
September
-
October
-
November
-
December
Constants
pub const unix_epoch: Time = Time(0, 0, option.None)
starting point of unix timestamps
Functions
pub fn difference(a: Time, b: Time) -> Duration
pub fn from_iso8601(value: String) -> Result(Time, Nil)
pub fn from_unix(value: Int) -> Time
unix timestamps are the number of seconds that have elapsed since 00:00:00 UTC on January 1st, 1970
pub fn get_offset(value: Time) -> String
pub fn now_with_offset(offset: String) -> Result(Time, Nil)
use this to get the current time with a given offset.
Some examples of acceptable offsets:
"+330", "03:30", "-8:00","-7", "-0400", "03"
pub fn range(from a: Time, to b: Option(Time), step s: Duration) -> Iterator(
Time,
)
can be used to create a time range starting from time a with step s
if b is option.None
the range will be infinite
pub fn set_offset(value: Time, new_offset: String) -> Result(
Time,
Nil,
)
use this tp change the offset of a given time value.
Some examples of acceptable offsets:
"+330", "03:30", "-8:00","-7", "-0400", "03", "Z"
pub fn short_string_month(value: Time) -> String
pub fn short_string_weekday(value: Time) -> String
pub fn string_month(value: Time) -> String
pub fn string_weekday(value: Time) -> String
pub fn to_iso8601(value: Time) -> String
pub fn to_unix(value: Time) -> Int
unix timestamps are the number of seconds that have elapsed since 00:00:00 UTC on January 1st, 1970