Represents a specific point in time associated with a TimeZone
.
- timestamp : Std.Time.Timestamp
Timestamp
represents the exact moment in time. It's a UTC relatedTimestamp
. - date : Thunk Std.Time.PlainDateTime
Instances For
Equations
- Std.Time.instBEqDateTime = { beq := fun (x y : Std.Time.DateTime tz) => x.timestamp == y.timestamp }
Creates a new DateTime
out of a Timestamp
that is in a TimeZone
.
Equations
- Std.Time.DateTime.ofTimestamp tm tz = { timestamp := tm, date := { fn := fun (x : Unit) => tm.toPlainDateTimeAssumingUTC.addSeconds tz.toSeconds } }
Instances For
Converts a DateTime
to the number of days since the UNIX epoch.
Equations
- date.toDaysSinceUNIXEpoch = date.date.get.toDaysSinceUNIXEpoch
Instances For
Creates a Timestamp
out of a DateTime
.
Equations
- date.toTimestamp = date.timestamp
Instances For
Changes the TimeZone
to a new one.
Equations
- date.convertTimeZone tz₁ = Std.Time.DateTime.ofTimestamp date.timestamp tz₁
Instances For
Creates a new DateTime
out of a PlainDateTime
. It assumes that the PlainDateTime
is relative
to UTC.
Equations
- Std.Time.DateTime.ofPlainDateTimeAssumingUTC date tz = { timestamp := Std.Time.Timestamp.ofPlainDateTimeAssumingUTC date, date := { fn := fun (x : Unit) => date.addSeconds tz.toSeconds } }
Instances For
Creates a new DateTime
from a PlainDateTime
, assuming that the PlainDateTime
is relative to the given TimeZone
.
Equations
- Std.Time.DateTime.ofPlainDateTime date tz = { timestamp := Std.Time.Timestamp.ofPlainDateTimeAssumingUTC (date.subSeconds tz.toSeconds), date := { fn := fun (x : Unit) => date } }
Instances For
Add Hour.Offset
to a DateTime
.
Equations
- dt.addHours hours = Std.Time.DateTime.ofPlainDateTime (dt.date.get.addHours hours) tz
Instances For
Subtract Hour.Offset
from a DateTime
.
Equations
- dt.subHours hours = Std.Time.DateTime.ofPlainDateTime (dt.date.get.subHours hours) tz
Instances For
Add Minute.Offset
to a DateTime
.
Equations
- dt.addMinutes minutes = Std.Time.DateTime.ofPlainDateTime (dt.date.get.addMinutes minutes) tz
Instances For
Subtract Minute.Offset
from a DateTime
.
Equations
- dt.subMinutes minutes = Std.Time.DateTime.ofPlainDateTime (dt.date.get.subMinutes minutes) tz
Instances For
Add Second.Offset
to a DateTime
.
Equations
- dt.addSeconds seconds = Std.Time.DateTime.ofPlainDateTime (dt.date.get.addSeconds seconds) tz
Instances For
Subtract Second.Offset
from a DateTime
.
Equations
- dt.subSeconds seconds = Std.Time.DateTime.ofPlainDateTime (dt.date.get.subSeconds seconds) tz
Instances For
Add Millisecond.Offset
to a DateTime
.
Equations
- dt.addMilliseconds milliseconds = Std.Time.DateTime.ofPlainDateTime (dt.date.get.addMilliseconds milliseconds) tz
Instances For
Subtract Millisecond.Offset
from a DateTime
.
Equations
- dt.subMilliseconds milliseconds = Std.Time.DateTime.ofPlainDateTime (dt.date.get.subMilliseconds milliseconds) tz
Instances For
Add Nanosecond.Offset
to a DateTime
.
Equations
- dt.addNanoseconds nanoseconds = Std.Time.DateTime.ofPlainDateTime (dt.date.get.addNanoseconds nanoseconds) tz
Instances For
Subtract Nanosecond.Offset
from a DateTime
.
Equations
- dt.subNanoseconds nanoseconds = Std.Time.DateTime.ofPlainDateTime (dt.date.get.subNanoseconds nanoseconds) tz
Instances For
Add Day.Offset
to a DateTime
.
Equations
- dt.addDays days = Std.Time.DateTime.ofPlainDateTime (dt.date.get.addDays days) tz
Instances For
Subtracts Day.Offset
to a DateTime
.
Equations
- dt.subDays days = Std.Time.DateTime.ofPlainDateTime (dt.date.get.subDays days) tz
Instances For
Add Week.Offset
to a DateTime
.
Equations
- dt.addWeeks weeks = Std.Time.DateTime.ofPlainDateTime (dt.date.get.addWeeks weeks) tz
Instances For
Subtracts Week.Offset
to a DateTime
.
Equations
- dt.subWeeks weeks = Std.Time.DateTime.ofPlainDateTime (dt.date.get.subWeeks weeks) tz
Instances For
Add Month.Offset
to a DateTime
, it clips the day to the last valid day of that month.
Equations
- dt.addMonthsClip months = Std.Time.DateTime.ofPlainDateTime (dt.date.get.addMonthsClip months) tz
Instances For
Subtracts Month.Offset
from a DateTime
, it clips the day to the last valid day of that month.
Equations
- dt.subMonthsClip months = Std.Time.DateTime.ofPlainDateTime (dt.date.get.subMonthsClip months) tz
Instances For
Add Month.Offset
from a DateTime
, this function rolls over any excess days into the following
month.
Equations
- dt.addMonthsRollOver months = Std.Time.DateTime.ofPlainDateTime (dt.date.get.addMonthsRollOver months) tz
Instances For
Subtract Month.Offset
from a DateTime
, this function rolls over any excess days into the following
month.
Equations
- dt.subMonthsRollOver months = Std.Time.DateTime.ofPlainDateTime (dt.date.get.subMonthsRollOver months) tz
Instances For
Add Year.Offset
to a DateTime
, this function rolls over any excess days into the following
month.
Equations
- dt.addYearsRollOver years = Std.Time.DateTime.ofPlainDateTime (dt.date.get.addYearsRollOver years) tz
Instances For
Add Year.Offset
to a DateTime
, it clips the day to the last valid day of that month.
Equations
- dt.addYearsClip years = Std.Time.DateTime.ofPlainDateTime (dt.date.get.addYearsClip years) tz
Instances For
Subtract Year.Offset
from a DateTime
, this function rolls over any excess days into the following
month.
Equations
- dt.subYearsRollOver years = Std.Time.DateTime.ofPlainDateTime (dt.date.get.subYearsRollOver years) tz
Instances For
Subtract Year.Offset
from to a DateTime
, it clips the day to the last valid day of that month.
Equations
- dt.subYearsClip years = Std.Time.DateTime.ofPlainDateTime (dt.date.get.subYearsClip years) tz
Instances For
Creates a new DateTime tz
by adjusting the day of the month to the given days
value, with any
out-of-range days clipped to the nearest valid date.
Equations
- dt.withDaysClip days = Std.Time.DateTime.ofPlainDateTime (dt.date.get.withDaysClip days) tz
Instances For
Creates a new DateTime tz
by adjusting the day of the month to the given days
value, with any
out-of-range days rolled over to the next month or year as needed.
Equations
- dt.withDaysRollOver days = Std.Time.DateTime.ofPlainDateTime (dt.date.get.withDaysRollOver days) tz
Instances For
Creates a new DateTime tz
by adjusting the month to the given month
value.
The day remains unchanged, and any invalid days for the new month will be handled according to the clip
behavior.
Equations
- dt.withMonthClip month = Std.Time.DateTime.ofPlainDateTime (dt.date.get.withMonthClip month) tz
Instances For
Creates a new DateTime tz
by adjusting the month to the given month
value.
The day is rolled over to the next valid month if necessary.
Equations
- dt.withMonthRollOver month = Std.Time.DateTime.ofPlainDateTime (dt.date.get.withMonthRollOver month) tz
Instances For
Creates a new DateTime tz
by adjusting the year to the given year
value. The month and day remain unchanged,
and any invalid days for the new year will be handled according to the clip
behavior.
Equations
- dt.withYearClip year = Std.Time.DateTime.ofPlainDateTime (dt.date.get.withYearClip year) tz
Instances For
Creates a new DateTime tz
by adjusting the year to the given year
value. The month and day are rolled
over to the next valid month and day if necessary.
Equations
- dt.withYearRollOver year = Std.Time.DateTime.ofPlainDateTime (dt.date.get.withYearRollOver year) tz
Instances For
Creates a new DateTime tz
by adjusting the hour
component.
Equations
- dt.withHours hour = Std.Time.DateTime.ofPlainDateTime (dt.date.get.withHours hour) tz
Instances For
Creates a new DateTime tz
by adjusting the minute
component.
Equations
- dt.withMinutes minute = Std.Time.DateTime.ofPlainDateTime (dt.date.get.withMinutes minute) tz
Instances For
Creates a new DateTime tz
by adjusting the second
component.
Equations
- dt.withSeconds second = Std.Time.DateTime.ofPlainDateTime (dt.date.get.withSeconds second) tz
Instances For
Creates a new DateTime tz
by adjusting the nano
component.
Equations
- dt.withNanoseconds nano = Std.Time.DateTime.ofPlainDateTime (dt.date.get.withNanoseconds nano) tz
Instances For
Creates a new DateTime tz
by adjusting the millisecond
component.
Equations
- dt.withMilliseconds milli = Std.Time.DateTime.ofPlainDateTime (dt.date.get.withMilliseconds milli) tz
Instances For
Converts a Timestamp
to a PlainDateTime
Equations
- dt.toPlainDateTime = dt.date.get
Instances For
Getter for the Year
inside of a DateTime
Equations
- dt.year = dt.date.get.year
Instances For
Getter for the Month
inside of a DateTime
Equations
- dt.month = dt.date.get.month
Instances For
Getter for the Day
inside of a DateTime
Equations
- dt.day = dt.date.get.day
Instances For
Getter for the Hour
inside of a DateTime
Equations
- dt.hour = dt.date.get.hour
Instances For
Getter for the Minute
inside of a DateTime
Equations
- dt.minute = dt.date.get.minute
Instances For
Getter for the Second
inside of a DateTime
Equations
- dt.second = dt.date.get.second
Instances For
Getter for the Milliseconds
inside of a DateTime
Equations
- dt.millisecond = Std.Time.Internal.Bounded.LE.emod dt.date.get.time.nanosecond 1000 Std.Time.DateTime.millisecond.proof_1
Instances For
Getter for the Nanosecond
inside of a DateTime
Equations
- dt.nanosecond = dt.date.get.time.nanosecond
Instances For
Gets the Weekday
of a DateTime.
Equations
- dt.weekday = dt.date.get.date.weekday
Instances For
Sets the DateTime
to the specified desiredWeekday
.
Equations
- dt.withWeekday desiredWeekday = Std.Time.DateTime.ofPlainDateTime (dt.date.get.withWeekday desiredWeekday) tz
Instances For
Determines the ordinal day of the year for the given DateTime
.
Equations
- date.dayOfYear = Std.Time.ValidDate.dayOfYear ⟨(date.month, date.day), ⋯⟩
Instances For
Determines the week of the year for the given DateTime
.
Equations
- date.weekOfYear = date.date.get.weekOfYear
Instances For
Returns the unaligned week of the month for a DateTime
(day divided by 7, plus 1).
Equations
- date.weekOfMonth = date.date.get.weekOfMonth
Instances For
Determines the week of the month for the given DateTime
. The week of the month is calculated based
on the day of the month and the weekday. Each week starts on Monday because the entire library is
based on the Gregorian Calendar.
Equations
- date.alignedWeekOfMonth = date.date.get.alignedWeekOfMonth
Instances For
Determines the quarter of the year for the given DateTime
.
Equations
- date.quarter = date.date.get.quarter
Instances For
Getter for the PlainTime
inside of a DateTime
Equations
- zdt.time = zdt.date.get.time
Instances For
Converts a DateTime
to the number of days since the UNIX epoch.
Equations
- Std.Time.DateTime.ofDaysSinceUNIXEpoch days time tz = Std.Time.DateTime.ofPlainDateTime (Std.Time.PlainDateTime.ofDaysSinceUNIXEpoch days time) tz
Instances For
Equations
- Std.Time.DateTime.instHAddOffset = { hAdd := Std.Time.DateTime.addDays }
Equations
- Std.Time.DateTime.instHSubOffset = { hSub := Std.Time.DateTime.subDays }
Equations
- Std.Time.DateTime.instHAddOffset_1 = { hAdd := Std.Time.DateTime.addWeeks }
Equations
- Std.Time.DateTime.instHSubOffset_1 = { hSub := Std.Time.DateTime.subWeeks }
Equations
- Std.Time.DateTime.instHAddOffset_2 = { hAdd := Std.Time.DateTime.addHours }
Equations
- Std.Time.DateTime.instHSubOffset_2 = { hSub := Std.Time.DateTime.subHours }
Equations
- Std.Time.DateTime.instHAddOffset_3 = { hAdd := Std.Time.DateTime.addMinutes }
Equations
- Std.Time.DateTime.instHSubOffset_3 = { hSub := Std.Time.DateTime.subMinutes }
Equations
- Std.Time.DateTime.instHAddOffset_4 = { hAdd := Std.Time.DateTime.addSeconds }
Equations
- Std.Time.DateTime.instHSubOffset_4 = { hSub := Std.Time.DateTime.subSeconds }
Equations
- Std.Time.DateTime.instHAddOffset_5 = { hAdd := Std.Time.DateTime.addMilliseconds }
Equations
- Std.Time.DateTime.instHSubOffset_5 = { hSub := Std.Time.DateTime.subMilliseconds }
Equations
- Std.Time.DateTime.instHAddOffset_6 = { hAdd := Std.Time.DateTime.addNanoseconds }
Equations
- Std.Time.DateTime.instHSubOffset_6 = { hSub := Std.Time.DateTime.subNanoseconds }
Equations
- Std.Time.DateTime.instHSubDuration = { hSub := fun (x : Std.Time.DateTime tz) (y : Std.Time.DateTime tz₁) => x.toTimestamp - y.toTimestamp }
Equations
- Std.Time.DateTime.instHAddDuration = { hAdd := fun (x : Std.Time.DateTime tz) (y : Std.Time.Duration) => x.addNanoseconds y.toNanoseconds }
Equations
- Std.Time.DateTime.instHSubDuration_1 = { hSub := fun (x : Std.Time.DateTime tz) (y : Std.Time.Duration) => x.subNanoseconds y.toNanoseconds }