Documentation

Std.Time.Zoned.DateTime

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 related Timestamp.

  • Date is a Thunk containing the PlainDateTime that represents the local date and time, it's used for accessing data like day and month without having to recompute the data everytime.

Instances For
    Equations
    • Std.Time.instBEqDateTime = { beq := fun (x y : Std.Time.DateTime tz) => x.timestamp == y.timestamp }
    Equations
    • Std.Time.instInhabitedDateTime = { default := { timestamp := default, date := { fn := fun (x : Unit) => default } } }
    @[inline]

    Creates a new DateTime out of a Timestamp that is in a TimeZone.

    Equations
    Instances For

      Converts a DateTime to the number of days since the UNIX epoch.

      Equations
      • date.toDaysSinceUNIXEpoch = date.date.get.toDaysSinceUNIXEpoch
      Instances For
        @[inline]

        Creates a Timestamp out of a DateTime.

        Equations
        • date.toTimestamp = date.timestamp
        Instances For
          @[inline]

          Changes the TimeZone to a new one.

          Equations
          Instances For
            @[inline]

            Creates a new DateTime out of a PlainDateTime. It assumes that the PlainDateTime is relative to UTC.

            Equations
            Instances For
              @[inline]

              Creates a new DateTime from a PlainDateTime, assuming that the PlainDateTime is relative to the given TimeZone.

              Equations
              Instances For
                @[inline]

                Add Hour.Offset to a DateTime.

                Equations
                Instances For
                  @[inline]

                  Subtract Hour.Offset from a DateTime.

                  Equations
                  Instances For
                    @[inline]

                    Add Minute.Offset to a DateTime.

                    Equations
                    Instances For
                      @[inline]

                      Subtract Minute.Offset from a DateTime.

                      Equations
                      Instances For
                        @[inline]

                        Add Second.Offset to a DateTime.

                        Equations
                        Instances For
                          @[inline]

                          Subtract Second.Offset from a DateTime.

                          Equations
                          Instances For
                            @[inline]

                            Add Millisecond.Offset to a DateTime.

                            Equations
                            Instances For
                              @[inline]

                              Subtract Millisecond.Offset from a DateTime.

                              Equations
                              Instances For
                                @[inline]

                                Add Nanosecond.Offset to a DateTime.

                                Equations
                                Instances For
                                  @[inline]

                                  Subtract Nanosecond.Offset from a DateTime.

                                  Equations
                                  Instances For
                                    @[inline]

                                    Add Day.Offset to a DateTime.

                                    Equations
                                    Instances For
                                      @[inline]

                                      Subtracts Day.Offset to a DateTime.

                                      Equations
                                      Instances For
                                        @[inline]

                                        Add Week.Offset to a DateTime.

                                        Equations
                                        Instances For
                                          @[inline]

                                          Subtracts Week.Offset to a DateTime.

                                          Equations
                                          Instances For

                                            Add Month.Offset to a DateTime, it clips the day to the last valid day of that month.

                                            Equations
                                            Instances For
                                              @[inline]

                                              Subtracts Month.Offset from a DateTime, it clips the day to the last valid day of that month.

                                              Equations
                                              Instances For

                                                Add Month.Offset from a DateTime, this function rolls over any excess days into the following month.

                                                Equations
                                                Instances For
                                                  @[inline]

                                                  Subtract Month.Offset from a DateTime, this function rolls over any excess days into the following month.

                                                  Equations
                                                  Instances For
                                                    @[inline]

                                                    Add Year.Offset to a DateTime, this function rolls over any excess days into the following month.

                                                    Equations
                                                    Instances For
                                                      @[inline]

                                                      Add Year.Offset to a DateTime, it clips the day to the last valid day of that month.

                                                      Equations
                                                      Instances For
                                                        @[inline]

                                                        Subtract Year.Offset from a DateTime, this function rolls over any excess days into the following month.

                                                        Equations
                                                        Instances For
                                                          @[inline]

                                                          Subtract Year.Offset from to a DateTime, it clips the day to the last valid day of that month.

                                                          Equations
                                                          Instances For
                                                            @[inline]

                                                            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
                                                            Instances For
                                                              @[inline]

                                                              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
                                                              Instances For
                                                                @[inline]

                                                                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
                                                                Instances For
                                                                  @[inline]

                                                                  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
                                                                  Instances For
                                                                    @[inline]

                                                                    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
                                                                    Instances For
                                                                      @[inline]

                                                                      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
                                                                      Instances For
                                                                        @[inline]

                                                                        Creates a new DateTime tz by adjusting the hour component.

                                                                        Equations
                                                                        Instances For
                                                                          @[inline]

                                                                          Creates a new DateTime tz by adjusting the minute component.

                                                                          Equations
                                                                          Instances For
                                                                            @[inline]

                                                                            Creates a new DateTime tz by adjusting the second component.

                                                                            Equations
                                                                            Instances For
                                                                              @[inline]

                                                                              Creates a new DateTime tz by adjusting the nano component.

                                                                              Equations
                                                                              Instances For
                                                                                @[inline]

                                                                                Creates a new DateTime tz by adjusting the millisecond component.

                                                                                Equations
                                                                                Instances For
                                                                                  @[inline]

                                                                                  Converts a Timestamp to a PlainDateTime

                                                                                  Equations
                                                                                  • dt.toPlainDateTime = dt.date.get
                                                                                  Instances For
                                                                                    @[inline]

                                                                                    Getter for the Year inside of a DateTime

                                                                                    Equations
                                                                                    • dt.year = dt.date.get.year
                                                                                    Instances For
                                                                                      @[inline]

                                                                                      Getter for the Month inside of a DateTime

                                                                                      Equations
                                                                                      • dt.month = dt.date.get.month
                                                                                      Instances For
                                                                                        @[inline]

                                                                                        Getter for the Day inside of a DateTime

                                                                                        Equations
                                                                                        • dt.day = dt.date.get.day
                                                                                        Instances For
                                                                                          @[inline]

                                                                                          Getter for the Hour inside of a DateTime

                                                                                          Equations
                                                                                          • dt.hour = dt.date.get.hour
                                                                                          Instances For
                                                                                            @[inline]

                                                                                            Getter for the Minute inside of a DateTime

                                                                                            Equations
                                                                                            • dt.minute = dt.date.get.minute
                                                                                            Instances For
                                                                                              @[inline]

                                                                                              Getter for the Second inside of a DateTime

                                                                                              Equations
                                                                                              • dt.second = dt.date.get.second
                                                                                              Instances For
                                                                                                @[inline]

                                                                                                Getter for the Milliseconds inside of a DateTime

                                                                                                Equations
                                                                                                Instances For
                                                                                                  @[inline]

                                                                                                  Getter for the Nanosecond inside of a DateTime

                                                                                                  Equations
                                                                                                  • dt.nanosecond = dt.date.get.time.nanosecond
                                                                                                  Instances For
                                                                                                    @[inline]

                                                                                                    Gets the Weekday of a DateTime.

                                                                                                    Equations
                                                                                                    • dt.weekday = dt.date.get.date.weekday
                                                                                                    Instances For

                                                                                                      Determines the era of the given DateTime based on its year.

                                                                                                      Equations
                                                                                                      • date.era = date.year.era
                                                                                                      Instances For

                                                                                                        Sets the DateTime to the specified desiredWeekday.

                                                                                                        Equations
                                                                                                        Instances For

                                                                                                          Checks if the DateTime is in a leap year.

                                                                                                          Equations
                                                                                                          • date.inLeapYear = date.year.isLeap
                                                                                                          Instances For

                                                                                                            Determines the ordinal day of the year for the given DateTime.

                                                                                                            Equations
                                                                                                            Instances For
                                                                                                              @[inline]

                                                                                                              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
                                                                                                                  @[inline]

                                                                                                                  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
                                                                                                                    @[inline]

                                                                                                                    Determines the quarter of the year for the given DateTime.

                                                                                                                    Equations
                                                                                                                    • date.quarter = date.date.get.quarter
                                                                                                                    Instances For
                                                                                                                      @[inline]

                                                                                                                      Getter for the PlainTime inside of a DateTime

                                                                                                                      Equations
                                                                                                                      • zdt.time = zdt.date.get.time
                                                                                                                      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
                                                                                                                        Equations
                                                                                                                        Equations