Announcement: All noncommercial projects registered to use Earth Engine beforeApril 15, 2025 mustverify noncommercial eligibility to maintain access. If you have not verified by September 26, 2025, your access may be on hold.

ee.FeatureCollection.filterDate

  • FeatureCollection.filterDate is a shortcut to filter a collection by a date range using the 'system:time_start' property.

  • Thestart andend arguments can be Dates, numbers (milliseconds since 1970-01-01T00:00:00Z), or strings.

  • Theend argument is optional, and if not provided, a 1-millisecond range starting atstart is used.

  • This method is equivalent to usingthis.filter(ee.Filter.date(...)).

Shortcut to filter a collection by a date range. The start and end may be Dates, numbers (interpreted as milliseconds since 1970-01-01T00:00:00Z), or strings (such as '1996-01-01T08:00'). Based on 'system:time_start'.

This is equivalent to this.filter(ee.Filter.date(...)); see the ee.Filter type for other date filtering options.

Returns the filtered collection.

UsageReturns
FeatureCollection.filterDate(start,end)Collection
ArgumentTypeDetails
this:collectionCollectionThe Collection instance.
startDate|Number|StringThe start date (inclusive).
endDate|Number|String, optionalThe end date (exclusive). Optional. If not specified, a 1-millisecond range starting at 'start' is created.

Examples

Code Editor (JavaScript)

// Constructed FeatureCollection representing a field site sampled at// four different dates; date recorded as "system:time_start" property in units// of milliseconds since Unix epoch.vargeom=ee.Geometry.Point([-119.56,37.67]);varfc=ee.FeatureCollection([ee.Feature(geom,{'prop':10,'system:time_start':ee.Date('2021-06-10')}),ee.Feature(geom,{'prop':11,'system:time_start':ee.Date('2021-06-20')}),ee.Feature(geom,{'prop':19,'system:time_start':ee.Date('2021-07-10')}),ee.Feature(geom,{'prop':10,'system:time_start':ee.Date('2021-07-20')})]);// Filter the observations in July 2021.print('Field site observations collection in July 2021',fc.filterDate('2021-07-01','2021-08-01'));// Alternative input formats.print('ee.DateRange as an input',fc.filterDate(ee.DateRange('2021-07-01','2021-08-01')));print('Numbers (milliseconds since Unix epoch) as an input',fc.filterDate(1625875200000,1626739200001));print('ee.Date objects as an input',fc.filterDate(ee.Date('2021-07-01'),ee.Date('2021-08-01')));

Python setup

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

importeeimportgeemap.coreasgeemap

Colab (Python)

# Constructed FeatureCollection representing a field site sampled at# four different dates; date recorded as "system:time_start" property in units# of milliseconds since Unix epoch.geom=ee.Geometry.Point([-119.56,37.67])fc=ee.FeatureCollection([ee.Feature(geom,{'prop':10,'system:time_start':ee.Date('2021-06-10')}),ee.Feature(geom,{'prop':11,'system:time_start':ee.Date('2021-06-20')}),ee.Feature(geom,{'prop':19,'system:time_start':ee.Date('2021-07-10')}),ee.Feature(geom,{'prop':10,'system:time_start':ee.Date('2021-07-20')})])# Filter the observations in July 2021.display('Field site observations collection in July 2021:',fc.filterDate('2021-07-01','2021-08-01'))# Alternative input formats.display('ee.DateRange as an input:',fc.filterDate(ee.DateRange('2021-07-01','2021-08-01')))display('Numbers (milliseconds since Unix epoch) as an input:',fc.filterDate(1625875200000,1626739200001))display('ee.Date objects as an input:',fc.filterDate(ee.Date('2021-07-01'),ee.Date('2021-08-01')))

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-10-06 UTC.