ZonedDateTime.fromEpochMilliseconds constructor
ZonedDateTime.fromEpochMilliseconds(
- Timezone timezone,
- EpochMilliseconds milliseconds
Creates a ZonedDateTime that represents the milliseconds
since Unix epoch (January 1st 1970) in the timezone
.
final timezone = Timezone('Asia/Singapore');
final milliseconds = 1682865000000; // 2023-04-30T14:30Z
final date = ZonedDateTime.fromEpochMilliseconds(timezone, milliseconds));
print(date); // 2023-04-30T22:30+08:00[Asia/Singapore]
Implementation
ZonedDateTime.fromEpochMilliseconds(Timezone timezone, EpochMilliseconds milliseconds): this._(
timezone,
timezone.span(at: milliseconds * 1000),
milliseconds * 1000,
);