Duyuru:
15 Nisan 2025'ten önce Earth Engine'i kullanmak için kaydedilen tüm ticari olmayan projelerin Earth Engine erişimini sürdürmek için
ticari olmayan uygunluğu doğrulaması gerekir.
ee.Date.advance
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Belirtilen bir tarihe belirtilen birimleri ekleyerek yeni bir tarih oluşturun.
Kullanım | İadeler |
---|
Date.advance(delta, unit, timeZone) | Tarih |
Bağımsız Değişken | Tür | Ayrıntılar |
---|
bu: date | Tarih | |
delta | Kayan | |
unit | Dize | "yıl", "ay", "hafta", "gün", "saat", "dakika" veya "saniye" seçeneklerinden biri. |
timeZone | Dize, varsayılan: null | Saat dilimi (ör. 'America/Los_Angeles'); varsayılan olarak UTC'dir. |
Örnekler
Kod Düzenleyici (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 kurulumu
Python API'si ve etkileşimli geliştirme için geemap
kullanımı hakkında bilgi edinmek üzere
Python Ortamı sayfasına bakın.
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'))
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-25 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-25 UTC."],[[["\u003cp\u003e\u003ccode\u003eDate.advance()\u003c/code\u003e creates a new Date object by adding a specified amount of time to an existing Date.\u003c/p\u003e\n"],["\u003cp\u003eThe time units for advancement can be 'year', 'month', 'week', 'day', 'hour', 'minute', or 'second'.\u003c/p\u003e\n"],["\u003cp\u003eA positive \u003ccode\u003edelta\u003c/code\u003e argument moves the date forward in time, while a negative \u003ccode\u003edelta\u003c/code\u003e moves it backward.\u003c/p\u003e\n"],["\u003cp\u003eThe optional \u003ccode\u003etimeZone\u003c/code\u003e argument specifies the time zone for the calculation; it defaults to UTC if not provided.\u003c/p\u003e\n"]]],["The `Date.advance` function modifies a given date by adding a specified `delta` of time units. Units can be 'year', 'month', 'week', 'day', 'hour', 'minute', or 'second'. A negative `delta` subtracts time. An optional `timeZone` argument sets the time zone. It takes a date object, a float for `delta` and string for `unit` as arguments. The function returns a new Date object with modified time.\n"],null,["# ee.Date.advance\n\nCreate a new Date by adding the specified units to the given Date.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-------------------------------------------|---------|\n| Date.advance`(delta, unit, `*timeZone*`)` | Date |\n\n| Argument | Type | Details |\n|--------------|-----------------------|-----------------------------------------------------------------------|\n| this: `date` | Date | |\n| `delta` | Float | |\n| `unit` | String | One of 'year', 'month', 'week', 'day', 'hour', 'minute', or 'second'. |\n| `timeZone` | String, default: null | The time zone (e.g., 'America/Los_Angeles'); defaults to UTC. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Defines a base date/time for the following examples.\nvar BASE_DATE = ee.Date('2020-7-1T13:00', 'UTC');\nprint(BASE_DATE, 'The base date/time');\n\n// Demonstrates basic usage.\nprint(BASE_DATE.advance(1, 'week'), '+1 week');\nprint(BASE_DATE.advance(2, 'years'), '+2 years');\n\n// Demonstrates that negative delta moves back in time.\nprint(BASE_DATE.advance(-1, 'second'), '-1 second');\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# Defines a base date/time for the following examples.\nBASE_DATE = ee.Date('2020-01-01T00:00', 'UTC')\ndisplay('The base date/time', BASE_DATE)\n\n# Demonstrates basic usage.\ndisplay('+1 week', BASE_DATE.advance(1, 'week'))\ndisplay('+2 years', BASE_DATE.advance(2, 'years'))\n\n# Demonstrates that negative delta moves back in time.\ndisplay('-1 second', BASE_DATE.advance(-1, 'second'))\n```"]]