fromSecondsSinceEpoch static method

TZDateTime fromSecondsSinceEpoch(
  1. Location location,
  2. int secondsSinceEpoch
)

Constructs a new tz.TZDateTime instance with the given secondsSinceEpoch.

The constructed tz.TZDateTime represents 1970-01-01T00:00:secondsSinceEpochZ in the given time zone location.

final newYearsDay =
    DateTimeUtils.fromSecondsSinceEpoch(1641031200, location:tz.UTC);
print(newYearsDay); // 2022-01-01 10:00:00.000Z

Implementation

static tz.TZDateTime fromSecondsSinceEpoch(tz.Location location, int secondsSinceEpoch) {
  final millisecondsSinceEpoch = secondsSinceEpoch * Duration.millisecondsPerSecond;

  return tz.TZDateTime.fromMillisecondsSinceEpoch(location, millisecondsSinceEpoch);
}