ee.Date.parse

Parse a date string, given a string describing its format.

UsageReturns
ee.Date.parse(format, date, timeZone)Date
ArgumentTypeDetails
formatStringA pattern, as described at http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html.
dateStringA string matching the given pattern.
timeZoneString, default: nullThe 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'));

Python setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

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'))