TZDateTime.from constructor

TZDateTime.from(
  1. DateTime other,
  2. Location location
)

Constructs a new TZDateTime instance from the given DateTime in the specified location.

final laTime = TZDateTime(la, 2010, 1, 1);
final detroitTime = TZDateTime.from(laTime, detroit);

Implementation

TZDateTime.from(DateTime other, Location location)
    : this._(
          _toNative(other).toUtc(),
          location,
          _isUtc(location)
              ? TimeZone.UTC
              : location.timeZone(other.millisecondsSinceEpoch));