String toString( )

Returns a human-readable string for this instance.

The returned string is constructed for the time zone of this instance. The toString() method provides a simply formatted string. It does not support internationalized strings. Use the intl package at the pub shared packages repo.

The resulting string can be parsed back using parse.

Source

/**
 * Returns a human-readable string for this instance.
 *
 * The returned string is constructed for the time zone of this instance.
 * The `toString()` method provides a simply formatted string.
 * It does not support internationalized strings.
 * Use the [intl](http://pub.dartlang.org/packages/intl) package
 * at the pub shared packages repo.
 *
 * The resulting string can be parsed back using [parse].
 */
String toString() {
  String y = _fourDigits(year);
  String m = _twoDigits(month);
  String d = _twoDigits(day);
  String h = _twoDigits(hour);
  String min = _twoDigits(minute);
  String sec = _twoDigits(second);
  String ms = _threeDigits(millisecond);
  if (isUtc) {
    return "$y-$m-$d $h:$min:$sec.${ms}Z";
  } else {
    return "$y-$m-$d $h:$min:$sec.$ms";
  }
}