DateTime¶
Import: import system;
Read the usage guide for examples and common tasks. This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation.
DateTime¶
A calendar date and time of day.
constructor¶
Creates a DateTime with epoch_millis, offset_minutes.
epoch_millis¶
UTC time as milliseconds since the Unix epoch.
offset_minutes¶
Offset from UTC, in minutes.
utc_now¶
Returns the current instant with a UTC offset of zero. Unlike now, it reads only the clock and does not consult the timezone database, so it works where timezone support is not linked.
now¶
Returns the current instant in the machine's local timezone.
now_in¶
The current instant in zone (an IANA timezone, see TimeZone).
from_epoch_millis¶
Wraps a raw UTC epoch millisecond instant.
epoch_seconds¶
UTC time as whole seconds since the Unix epoch.
from_epoch_seconds¶
Creates a UTC date/time from seconds since the Unix epoch.
of¶
Builds a UTC instant from calendar fields.
public static fun of(
year: int,
month: int,
day: int,
hour: int,
minute: int,
second: int,
millisecond: int
): DateTime
of_local¶
Builds an instant from calendar fields interpreted as local wall-clock time.
public static fun of_local(
year: int,
month: int,
day: int,
hour: int,
minute: int,
second: int,
millisecond: int
): DateTime
of_zoned¶
Builds an instant from calendar fields interpreted as wall-clock time in zone.
public static fun of_zoned(
year: int,
month: int,
day: int,
hour: int,
minute: int,
second: int,
millisecond: int,
zone: TimeZone
): DateTime
to_utc¶
The same instant in UTC.
to_local¶
The same instant in the local system timezone.
to_zone¶
The same instant in zone (an IANA timezone, see TimeZone).
year¶
The calendar year in this value's UTC offset (proleptic Gregorian; 0 is 1 BC).
month¶
The month in this value's UTC offset, from 1 (January) to 12 (December).
day¶
The day of the month in this value's UTC offset, from 1 to 31.
hour¶
The hour of the day in this value's UTC offset, from 0 to 23.
minute¶
The minute of the hour, from 0 to 59.
second¶
The second of the minute, from 0 to 59; leap seconds are not represented.
millisecond¶
The millisecond of the second, from 0 to 999.
day_of_week¶
The day of the week (0 = Sunday).