W3cubDocs

/Dart 2

toUtc method

DateTime toUtc ()

Returns this DateTime value in the UTC time zone.

Returns this if it is already in UTC. Otherwise this method is equivalent to:

new DateTime.fromMicrosecondsSinceEpoch(microsecondsSinceEpoch,
                                        isUtc: true)

Implementation

DateTime toUtc() {
  if (isUtc) return this;
  return new DateTime._withValue(_value, isUtc: true);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-core/DateTime/toUtc.html