Stdlib index
- Captured-borrow migration worklist (3.3.3)
- Owned-bind migration worklist (8.2.7)
- Return-side title audit — the ride-through enumeration
- stdlib ownership audit
- stdlib ownership dispositions (plan 1.3.1 / 4.3.1)
codec
codec / csv
codec / json
collection
- ArrayList
- BPlusTree
- Cache
- Collectors
- HashMap
- HashSet
- Heap
- ImmutableList
- ImmutableMap
- ImmutableSet
- LinkedList
- RedBlackTree
- Sort
collection / ltm
concurrent
error
gfx
hash
ifx
io
io / file
io / net
io / net / dns
io / net / tls
io / net / uri
lang
lang / stream
math
math / fft
math / linalg
math / npio
math / poly
math / random
math / stats
nucleo
- Columns — the Arrow-laid-out substrate
- Fused tensor expressions — Fuse
- Table — the lazy, typed dataframe
- Tape — define-by-run autograd
- Transform intrinsics — Grad, Vmap, Jit
process
reflect
search / distance
search / fuzzy
search / ngram
session
time
- Clock
- DateTimeFormatter
- Duration
- Instant
- LocalDate
- LocalDateTime
- LocalTime
- Period
- ZonedDateTime
- ZoneId
- ZoneOffset
wire
xpu
xpu / mesh
ZoneOffset
cajeta.time.ZoneOffset — a fixed offset from UTC, e.g. +05:30, -08:00, or
Z (UTC), modeled on java.time.ZoneOffset. Stored as a single int32
total-seconds value in [-64800, 64800] (±18 hours); a pure stack value type.
Build one through the of*/utc factories rather than the raw constructor —
they range-check and throw DateTimeException on bad input. Fixed offsets are
the zone backbone for ZonedDateTime; DST-aware region
lookups live in ZoneId.
ZoneOffset ist = ZoneOffset.ofHoursMinutes(5, 30);
ZoneOffset pst = ZoneOffset.ofHours(-8);
boolean east = ist.compareTo(pst) > 0; // true
String id #= ist.iso(); // "+05:30"
Methods
| Signature | |
|---|---|
ZoneOffset(int32 totalSeconds) | A raw offset from a totalSeconds value; performs no range check |
static ZoneOffset ofTotalSeconds(int32 totalSeconds) ⚑ | Offset of totalSeconds seconds from UTC; throws DateTimeException outside [-64800, 64800] |
static ZoneOffset ofHours(int32 hours) ⚑ | Offset of whole hours; throws DateTimeException outside ±18 |
static ZoneOffset ofHoursMinutes(int32 hours, int32 minutes) ⚑ | Offset of hours and minutes; both parts must share the offset’s sign |
static ZoneOffset utc() ⚑ | The UTC offset (zero), the Z of +00:00 |
int32 getTotalSeconds() | Total offset in seconds from UTC (may be negative) |
int32 compareTo(ZoneOffset other) | Ascending order by offset seconds |
int64 hash() | Content hash of the offset seconds |
#String iso() | ISO offset id: Z for UTC, else +HH:mm / -HH:mm (:ss appended only for a nonzero seconds part) |
static boolean operator== (ZoneOffset a, ZoneOffset b) | Value equality — a == b |
⚑ = @EntryPoint
See also
- Tour: TimeDemo
- Source:
runtime/src/cajeta/time/ZoneOffset.cajeta - ZoneId, ZonedDateTime, Instant