LanguageValues and typesStandard typesTime and calendar
LocalTime
On this page
A time on the clock, with no date or zone: 09:30:00.
Use it for a time that repeats, such as a shop opening at 09:30. For one moment, use Instant.
Shape
| Field | Type | Required? |
|---|---|---|
hour |
Int |
Yes |
minute |
Int |
Yes |
second |
Int |
Yes |
Example
LocalTime { hour: 9 minute: 30 second: 0 }text.parse(raw, as: LocalTime) reads one from text that comes from outside. Text that isn't one at all fails malformed, such as 24:00:00, 09:30 or 9:30:00.
Good to know
- The hour runs from 0 to 23.
24:00:00is refused, and text needs the seconds, so09:30is refused as well. ==tells you whether two are the same, and<andlist.sort_bycompare and sort them.
In JSON
A string, in a request, a response or json.write:
"00:00:00""09:30:00""23:59:59"
Details
Text form, storage, how it is shown, and operations
LocalTime is in the group Time and calendar, and has been in Jadpo since 0.1.0.
Text form
text.from writes one standard text form, the same form text.parse reads back: 00:00:00, 09:30:00 and 23:59:59.
How it is stored
It is stored in one column named for the field, of type time. 09:30:00 is stored as '09:30:00.000000'::time.
How it is shown to people
text.format(value, locale:) shows it to people in their locale. A call also gives format:.
With locale: Locale.en_gb and format: TimeFormat.time_medium:
| Value | Shown |
|---|---|
00:00:00 |
00:00:00 |
09:30:00 |
09:30:00 |
23:59:59 |
23:59:59 |
Operations
It also takes text.parse, text.from, text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-local-time.md.Built from Jadpo main at aee2e8f.