DateTime.fromMicrosecondsSinceEpoch constructor Null safety

  1. int microsecondsSinceEpoch,
  2. {bool isUtc = false}

Constructs a new DateTime instance with the given microsecondsSinceEpoch.

If isUtc is false, then the date is in the local time zone.

The constructed DateTime represents 1970-01-01T00:00:00Z + microsecondsSinceEpoch us in the given time zone (local or UTC).

final newYearsEve =
    DateTime.fromMicrosecondsSinceEpoch(1640901600000000, isUtc:true);
print(newYearsEve); // 2021-12-31 19:30:00.000Z


external DateTime.fromMicrosecondsSinceEpoch(int microsecondsSinceEpoch,
    {bool isUtc = false});