Constructs a new DateTime instance
with the given millisecondsSinceEpoch
.
If isUtc
is false then the date is in the local time zone.
The constructed DateTime represents
1970-01-01T00:00:00Z + millisecondsSinceEpoch
ms in the given
time zone (local or UTC).
Source
DateTime.fromMillisecondsSinceEpoch(int millisecondsSinceEpoch,
{bool isUtc: false})
: this.millisecondsSinceEpoch = millisecondsSinceEpoch,
this.isUtc = isUtc {
if (millisecondsSinceEpoch.abs() > _MAX_MILLISECONDS_SINCE_EPOCH) {
throw new ArgumentError(millisecondsSinceEpoch);
}
if (isUtc == null) throw new ArgumentError(isUtc);
}