ee.Date.update
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
สร้างวันที่ใหม่โดยตั้งค่าหน่วยอย่างน้อย 1 หน่วยของวันที่ที่ระบุเป็นค่าใหม่ หากระบุ timeZone ระบบจะตีความค่าใหม่ในโซนนั้น
การใช้งาน | การคืนสินค้า |
---|
Date.update(year, month, day, hour, minute, second, timeZone) | วันที่ |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ date | วันที่ | |
year | จำนวนเต็ม ค่าเริ่มต้น: null | |
month | จำนวนเต็ม ค่าเริ่มต้น: null | |
day | จำนวนเต็ม ค่าเริ่มต้น: null | |
hour | จำนวนเต็ม ค่าเริ่มต้น: null | |
minute | จำนวนเต็ม ค่าเริ่มต้น: null | |
second | ตัวเลข ค่าเริ่มต้น: null | |
timeZone | สตริง ค่าเริ่มต้น: null | เขตเวลา (เช่น 'America/Los_Angeles'); ค่าเริ่มต้นคือ UTC |
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (JavaScript)
var date = ee.Date('2021-4-30T07:15:31.24');
print('Updated year and minute components of the input date',
date.update({
year: 2010,
minute: 59
})
);
การตั้งค่า Python
ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap
เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า
สภาพแวดล้อม Python
import ee
import geemap.core as geemap
Colab (Python)
date = ee.Date('2021-4-30T07:15:31.24')
display(
'Updated year and minute components of the input date:',
date.update(year=2010, minute=59)
)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eThe \u003ccode\u003eDate.update()\u003c/code\u003e function modifies specific components (year, month, day, hour, minute, second) of an existing Earth Engine \u003ccode\u003eDate\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eThe function accepts optional arguments for each date/time component, using the provided values to update the original date.\u003c/p\u003e\n"],["\u003cp\u003eIf a \u003ccode\u003etimeZone\u003c/code\u003e is specified, the new date/time components are interpreted within that time zone, otherwise defaulting to UTC.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eDate.update()\u003c/code\u003e returns a new \u003ccode\u003eDate\u003c/code\u003e object with the modifications, leaving the original date unchanged.\u003c/p\u003e\n"]]],[],null,["# ee.Date.update\n\nCreate a new Date by setting one or more of the units of the given Date to a new value. If a timeZone is given the new value(s) is interpreted in that zone.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------------------------------------------------------------------------------------|---------|\n| Date.update`(`*year* `, `*month* `, `*day* `, `*hour* `, `*minute* `, `*second* `, `*timeZone*`)` | Date |\n\n| Argument | Type | Details |\n|--------------|------------------------|---------------------------------------------------------------|\n| this: `date` | Date | |\n| `year` | Integer, default: null | |\n| `month` | Integer, default: null | |\n| `day` | Integer, default: null | |\n| `hour` | Integer, default: null | |\n| `minute` | Integer, default: null | |\n| `second` | Number, default: null | |\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\nvar date = ee.Date('2021-4-30T07:15:31.24');\n\nprint('Updated year and minute components of the input date',\n date.update({\n year: 2010,\n minute: 59\n })\n);\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\ndate = ee.Date('2021-4-30T07:15:31.24')\n\ndisplay(\n 'Updated year and minute components of the input date:',\n date.update(year=2010, minute=59)\n)\n```"]]