Skip to content
FutureBlitz

    Install

    Import std.time.calendar

    TimeOfDay

    std.time.calendar

    struct

    Public Struct TimeOfDay Implements Comparable, Hashable, Printable, Defaultable

    A time on a day's clock, from midnight to a nanosecond before the next.

    Examples

    Local late = TimeOfDay(23, 30)
    Expect("{late}" == "23:30:00")
    Expect(late + 2.Hours == TimeOfDay(1, 30))
    Expect(late.Format("h:mm a") == "11:30 PM")

    std/time/calendar.fb, line 266

    • @PanicsAtCaller Public New(hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0) constructor #

      The time, which panics when it isn't one: hours from 0 to 23, minutes and seconds from 0 to 59, and nanoseconds from 0 to 999999999.

    • @PanicsAtCaller Public Static Method FromNanosecondOfDay(nanoseconds: Int64): TimeOfDay static method #

      The time that many nanoseconds after midnight, which panics when it's not on the day.

    • Public Static Method Midnight(): TimeOfDay static method #

      The time at the start of a day: 00:00.

    • Public Static Method Noon(): TimeOfDay static method #

      The time in the middle of a day: 12:00.

    • Public Static Method DefaultValue(): TimeOfDay static method #

      Midnight, 00:00:00.

    • Public Static Method MinValue(): TimeOfDay static method #

      The earliest time of day: 00:00.

    • Public Static Method MaxValue(): TimeOfDay static method #

      The latest time of day: a nanosecond before midnight.

    • Public Static Method Now(zone: TimeZone): TimeOfDay static method #

      Now, where the zone is, or the OS's zone.

    • Public Static Method Now(): TimeOfDay static method #

      Now, in the OS's zone.

    • Public Static Method IsValid(hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0): Bool static method #

      Whether hour, minute, second, and nanosecond are a time of day.

    • Public Static Method Parse(text: String): TimeOfDay? static method #

      The time ISO 8601 writes, like "12:30", "12:30:15", or "12:30:15.25", or Null.

    • @PanicsAtCaller Public Static Method Parse(text: String, pattern: String): TimeOfDay? static method #

      The time the text writes as the pattern says (see format.fb), or Null. A pattern without the hour panics.

    • Public Property Hour: Int property #

      From 0 to 23.

    • Public Property Minute: Int property #

      From 0 to 59.

    • Public Property Second: Int property #

      From 0 to 59.

    • Public Property Nanosecond: Int property #

      Of the second, from 0 to 999999999.

    • Public Property SecondOfDay: Int property #

      How many seconds of the day have gone by, from 0 to 86399.

    • Public Property NanosecondOfDay: Int64 property #

      How many nanoseconds of the day have gone by.

    • Operator +(a: TimeOfDay, b: Duration): TimeOfDay operator #

      a on the clock b after, around midnight as a clock goes: 23:00 plus 2 hours is 01:00.

    • Operator -(a: TimeOfDay, b: Duration): TimeOfDay operator #

      a on the clock b earlier, around midnight as a clock goes: 01:00 minus 2 hours is 23:00.

    • Operator -(a: TimeOfDay, b: TimeOfDay): Duration operator #

      How long it is from b to a on the same day, below 0 when a is earlier.

    • Operator <(a: TimeOfDay, b: TimeOfDay): Bool operator #

      Whether a is earlier on the clock than b.

    • Public Method ToString(): String method #

      As ISO 8601 writes it, with seconds, and a fraction only when there is one, like "12:30:00" and "12:30:00.25".

    • @PanicsAtCaller Public Method Format(pattern: String): String method #

      As the pattern says (see format.fb): Format("h:mm a") is "1:30 PM". A pattern letter of a date or a zone panics.

    Report an issue with this page or with FutureBlitz on GitHub.