Pengumuman: Semua project nonkomersial yang terdaftar untuk menggunakan Earth Engine sebelum
15 April 2025 harus
memverifikasi kelayakan nonkomersial untuk mempertahankan akses Earth Engine.
ee.Date.fromYMD
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Menampilkan Tanggal yang diberikan tahun, bulan, hari.
Penggunaan | Hasil |
---|
ee.Date.fromYMD(year, month, day, timeZone) | Tanggal |
Argumen | Jenis | Detail |
---|
year | Bilangan Bulat | Tahun, misalnya 2013. |
month | Bilangan Bulat | Bulan, misalnya 3. |
day | Bilangan Bulat | Hari, misalnya 15. |
timeZone | String, default: null | Zona waktu (misalnya, 'America/Los_Angeles'); defaultnya adalah UTC. |
Contoh
Code Editor (JavaScript)
print('Date with default UTC',
ee.Date.fromYMD(2021, 4, 30));
print('Date with time zone specified',
ee.Date.fromYMD(2021, 4, 30, 'America/Los_Angeles'));
Penyiapan Python
Lihat halaman
Lingkungan Python untuk mengetahui informasi tentang Python API dan penggunaan
geemap
untuk pengembangan interaktif.
import ee
import geemap.core as geemap
Colab (Python)
display('Date with default UTC:', ee.Date.fromYMD(2021, 4, 30))
display(
'Date with time zone specified:',
ee.Date.fromYMD(2021, 4, 30, 'America/Los_Angeles')
)
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eee.Date.fromYMD\u003c/code\u003e creates a Date object from year, month, and day inputs.\u003c/p\u003e\n"],["\u003cp\u003eThe function accepts optional \u003ccode\u003etimeZone\u003c/code\u003e argument to specify the time zone, defaulting to UTC if not provided.\u003c/p\u003e\n"],["\u003cp\u003eYou can use this function in both JavaScript and Python environments within Google Earth Engine.\u003c/p\u003e\n"]]],["The function `ee.Date.fromYMD` constructs a Date object using year, month, and day inputs, all of which are integers. Optionally, a `timeZone` string can be provided; otherwise, it defaults to UTC. The function returns a Date object. Examples are provided for both JavaScript and Python, demonstrating usage with and without specifying a time zone. The Python examples require the `ee` and `geemap` libraries.\n"],null,["# ee.Date.fromYMD\n\nReturns a Date given year, month, day.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------------------------------------|---------|\n| `ee.Date.fromYMD(year, month, day, `*timeZone*`)` | Date |\n\n| Argument | Type | Details |\n|------------|-----------------------|---------------------------------------------------------------|\n| `year` | Integer | The year, 2013, for example. |\n| `month` | Integer | The month, 3, for example. |\n| `day` | Integer | The day, 15, for example. |\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\nprint('Date with default UTC',\n ee.Date.fromYMD(2021, 4, 30));\n\nprint('Date with time zone specified',\n ee.Date.fromYMD(2021, 4, 30, 'America/Los_Angeles'));\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\ndisplay('Date with default UTC:', ee.Date.fromYMD(2021, 4, 30))\n\ndisplay(\n 'Date with time zone specified:',\n ee.Date.fromYMD(2021, 4, 30, 'America/Los_Angeles')\n)\n```"]]