ee.Date.advance

指定された日付に指定された単位を追加して、新しい日付を作成します。

用途戻り値
Date.advance(delta, unit, timeZone)日付
引数タイプ詳細
this: date日付
delta浮動小数点数
unit文字列「year」、「month」、「week」、「day」、「hour」、「minute」、「second」のいずれか。
timeZone文字列、デフォルト: nullタイムゾーン(例: 'America/Los_Angeles')。デフォルトは UTC です。

コードエディタ(JavaScript)

// Defines a base date/time for the following examples.
var BASE_DATE = ee.Date('2020-7-1T13:00', 'UTC');
print(BASE_DATE, 'The base date/time');

// Demonstrates basic usage.
print(BASE_DATE.advance(1, 'week'), '+1 week');
print(BASE_DATE.advance(2, 'years'), '+2 years');

// Demonstrates that negative delta moves back in time.
print(BASE_DATE.advance(-1, 'second'), '-1 second');

Python の設定

Python API とインタラクティブな開発での geemap の使用については、 Python 環境のページをご覧ください。

import ee
import geemap.core as geemap

Colab(Python)

# Defines a base date/time for the following examples.
BASE_DATE = ee.Date('2020-01-01T00:00', 'UTC')
display('The base date/time', BASE_DATE)

# Demonstrates basic usage.
display('+1 week', BASE_DATE.advance(1, 'week'))
display('+2 years', BASE_DATE.advance(2, 'years'))

# Demonstrates that negative delta moves back in time.
display('-1 second', BASE_DATE.advance(-1, 'second'))