DateTime.utc 构造函数

DateTime.utc(
  1. int year, [
  2. int month = 1,
  3. int day = 1,
  4. int hour = 0,
  5. int minute = 0,
  6. int second = 0,
  7. int millisecond = 0,
  8. int microsecond = 0,
])

构建一个指定在 UTC 时区的 DateTime 实例。

final moonLanding = DateTime.utc(1969, 7, 20, 20, 18, 04);

在处理日期或历史事件时,最好使用 UTC 日期时间,因为它们不受夏令时更改的影响,也不受本地时区的影响。

实现

DateTime.utc(int year,
    [int month = 1,
    int day = 1,
    int hour = 0,
    int minute = 0,
    int second = 0,
    int millisecond = 0,
    int microsecond = 0])
    : this._internal(year, month, day, hour, minute, second, millisecond,
          microsecond, true);