AI-generated Key Takeaways
-
ee.Date.parseis used to convert a date string into a Date object, given a format pattern. -
The function takes the format pattern and the date string as required arguments, with an optional time zone.
-
The format pattern follows the Joda-Time DateTimeFormat guidelines.
| Usage | Returns |
|---|---|
ee.Date.parse(format, date, timeZone
)
|
Date |
| Argument | Type | Details |
|---|---|---|
format
|
String | A pattern, as described at http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html. |
date
|
String | A string matching the given pattern. |
timeZone
|
String, default: null | The time zone (e.g., 'America/Los_Angeles'); defaults to UTC. |
Examples
Code Editor (JavaScript)
print ( ee . Date . parse ( 'yyyy MM dd' , '2021 4 30' )); print ( ee . Date . parse ( 'yyyy-MM-dd' , '2021-4-30' )); print ( ee . Date . parse ( 'yyyy/MM/dd' , '2021/4/30' )); print ( ee . Date . parse ( 'MM/dd/yy' , '4/30/21' )); print ( ee . Date . parse ( 'MMM. dd, yyyy' , 'Apr. 30, 2021' )); print ( ee . Date . parse ( 'yyyy-MM-dd HH:mm:ss' , '2021-4-30 00:00:00' ));
import ee import geemap.core as geemap
Colab (Python)
display ( ee . Date . parse ( 'YYYY MM dd' , '2021 4 30' )) display ( ee . Date . parse ( 'YYYY-MM-dd' , '2021-4-30' )) display ( ee . Date . parse ( 'YYYY/MM/dd' , '2021/4/30' )) display ( ee . Date . parse ( 'MM/dd/YY' , '4/30/21' )) display ( ee . Date . parse ( 'MMM. dd, YYYY' , 'Apr. 30, 2021' )) display ( ee . Date . parse ( 'YYYY-MM-dd HH:mm:ss' , '2021-4-30 00:00:00' ))

