Import std.time.calendar
TimeOfDay
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): TimeOfDaystatic method #The time that many
nanosecondsafter midnight, which panics when it's not on the day. -
The time at the start of a day: 00:00.
-
The time in the middle of a day: 12:00.
-
Midnight, 00:00:00.
-
The earliest time of day: 00:00.
-
The latest time of day: a nanosecond before midnight.
-
Now, where the
zoneis, or the OS'szone. -
Now, in the OS's zone.
-
Public Static Method IsValid(hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0): Boolstatic method #Whether
hour,minute,second, andnanosecondare a time of day. -
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
textwrites as thepatternsays (see format.fb), or Null. A pattern without the hour panics. -
From 0 to 23.
-
From 0 to 59.
-
From 0 to 59.
-
Of the second, from 0 to 999999999.
-
How many seconds of the day have gone by, from 0 to 86399.
-
How many nanoseconds of the day have gone by.
-
aon the clockbafter, around midnight as a clock goes: 23:00 plus 2 hours is 01:00. -
aon the clockbearlier, around midnight as a clock goes: 01:00 minus 2 hours is 23:00. -
How long it is from
btoaon the same day, below 0 whenais earlier. -
Whether
ais earlier on the clock thanb. -
As ISO 8601 writes it, with seconds, and a fraction only when there is one, like "12:30:00" and "12:30:00.25".
-
As the
patternsays (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.