Movatterモバイル変換


[0]ホーム

URL:


menu
  1. Dart
  2. dart:core
  3. DateTime
  4. add method
add
description

add method

DateTimeadd(
  1. Durationduration
)

Returns a newDateTime instance withduration added to thisDateTime.

final today = DateTime.now();final fiftyDaysFromNow = today.add(const Duration(days: 50));

Notice that the duration being added is actually 50 * 24 * 60 * 60seconds. If the resultingDateTime has a different daylight saving offsetthanthis, then the result won't have the same time-of-day asthis, andmay not even hit the calendar date 50 days later.

Be careful when working with dates in local time.

Implementation

external DateTime add(Duration duration);
  1. Dart
  2. dart:core
  3. DateTime
  4. add method
DateTime class

[8]ページ先頭

©2009-2025 Movatter.jp