公告:所有在 
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。如果您在 2025 年 9 月 26 日之前未完成验证,您的访问权限可能会被暂停。
  
        
 
       
     
  
  
  
    
  
  
  
    
      ee.Date.fromYMD
    
    
      
    
    
      
      使用集合让一切井井有条
    
    
      
      根据您的偏好保存内容并对其进行分类。
    
  
  
      
    
  
  
  
  
  
    
  
  
    
    
    
  
  
返回指定年、月、日的日期。
| 用法 | 返回 | 
|---|
ee.Date.fromYMD(year, month, day, timeZone) | 日期 | 
| 参数 | 类型 | 详细信息 | 
|---|
year | 整数 | 例如,2013 年。 | 
month | 整数 | 月份,例如 3。 | 
day | 整数 | 日期,例如 15。 | 
timeZone | 字符串,默认值:null | 时区(例如,“America/Los_Angeles”);默认为 UTC。 | 
  
  
  示例
  
    
  
  
    
    
  
  
  
  
    
    
    
      代码编辑器 (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'));
  
    
  
  
    
  
  
  
  
    
  
    
  Python 设置
  如需了解 Python API 和如何使用 geemap 进行交互式开发,请参阅 
    Python 环境页面。
  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')
)
  
  
  
  
  
 
  
    
    
      
       
    
    
  
  
  如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
  最后更新时间 (UTC):2025-07-26。
  
  
  
    
      [null,null,["最后更新时间 (UTC):2025-07-26。"],[],["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"]]