Stay organized with collectionsSave and categorize content based on your preferences.
Creates a DateRange with the given start (inclusive) and end (exclusive), which may be Dates, numbers (interpreted as milliseconds since 1970-01-01T00:00:00Z), or strings (such as '1996-01-01T08:00'). If 'end' is not specified, a 1-millisecond range starting at 'start' is created.
Usage
Returns
ee.DateRange(start,end,timeZone)
DateRange
Argument
Type
Details
start
Object
end
Object, default: null
timeZone
String, default: null
If start and/or end are provided as strings, the time zone in which to interpret them; defaults to UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["\u003cp\u003e\u003ccode\u003eee.DateRange\u003c/code\u003e creates a range of dates, allowing you to specify a start and end date (inclusive and exclusive, respectively).\u003c/p\u003e\n"],["\u003cp\u003eStart and end dates can be provided as Dates, numbers (milliseconds since epoch), or strings (e.g., 'YYYY-MM-DD' or 'YYYY-MM-DDTHH:mm:ss').\u003c/p\u003e\n"],["\u003cp\u003eIf only a start date is given, a 1-millisecond range is created starting at that date.\u003c/p\u003e\n"],["\u003cp\u003eYou can specify the time zone for string inputs using the optional \u003ccode\u003etimeZone\u003c/code\u003e argument, which defaults to UTC.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eee.DateRange\u003c/code\u003e is essential for temporal filtering and analysis in Earth Engine.\u003c/p\u003e\n"]]],[],null,["# ee.DateRange\n\nCreates a DateRange with the given start (inclusive) and end (exclusive), which may be Dates, numbers (interpreted as milliseconds since 1970-01-01T00:00:00Z), or strings (such as '1996-01-01T08:00'). If 'end' is not specified, a 1-millisecond range starting at 'start' is created.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------------|-----------|\n| `ee.DateRange(start, `*end* `, `*timeZone*`)` | DateRange |\n\n| Argument | Type | Details |\n|------------|-----------------------|---------------------------------------------------------------------------------------------------------|\n| `start` | Object | |\n| `end` | Object, default: null | |\n| `timeZone` | String, default: null | If start and/or end are provided as strings, the time zone in which to interpret them; defaults to UTC. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nprint('String date inputs (interpreted as UTC by default)',\n ee.DateRange('2017-06-24', '2017-07-24'));\n\nprint('String date inputs with timeZone argument',\n ee.DateRange('2017-06-24', '2017-07-24', 'America/Los_Angeles'));\n\nprint('String date-time inputs with timeZone argument',\n ee.DateRange('2017-06-24T07:00:00', '2017-07-24T07:00:00',\n 'America/Los_Angeles'));\n\nprint('A single date input results in a 1-millisecond range',\n ee.DateRange('2017-06-24'));\n\nprint('ee.Date inputs',\n ee.DateRange(ee.Date('2017-06-24'), ee.Date('2017-07-24')));\n\nprint('ee.Date date-time inputs (UTC by default)',\n ee.DateRange(ee.Date('2017-06-24T07:00:00'),\n ee.Date('2017-07-24T07:00:00')));\n\nprint('ee.Date date-time inputs with timeZone arguments',\n ee.DateRange(ee.Date('2017-06-24T07:00:00', 'UTC'),\n ee.Date('2017-07-24T07:00:00', 'America/Los_Angeles')));\n\nprint('Number inputs as milliseconds from Unix epoch (2017-06-24, 2017-07-24)',\n ee.DateRange(1498262400000, 1500854400000));\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\nprint('String date inputs (interpreted as UTC by default):',\n ee.DateRange('2017-06-24', '2017-07-24').getInfo())\n\nprint('String date inputs with timeZone argument:',\n ee.DateRange('2017-06-24', '2017-07-24', 'America/Los_Angeles').getInfo())\n\nprint('String date-time inputs with timeZone argument:',\n ee.DateRange('2017-06-24T07:00:00', '2017-07-24T07:00:00',\n 'America/Los_Angeles').getInfo())\n\nprint('A single date input results in a 1-millisecond range:',\n ee.DateRange('2017-06-24').getInfo())\n\nprint('ee.Date inputs',\n ee.DateRange(ee.Date('2017-06-24'), ee.Date('2017-07-24')).getInfo())\n\nprint('ee.Date date-time inputs (UTC by default):',\n ee.DateRange(ee.Date('2017-06-24T07:00:00'),\n ee.Date('2017-07-24T07:00:00')).getInfo())\n\nprint('ee.Date date-time inputs with timeZone arguments:',\n ee.DateRange(ee.Date('2017-06-24T07:00:00', 'UTC'),\n ee.Date('2017-07-24T07:00:00',\n 'America/Los_Angeles')).getInfo())\n\nprint('Number inputs as milliseconds from Unix epoch (2017-06-24, 2017-07-24):',\n ee.DateRange(1498262400000, 1500854400000).getInfo())\n```"]]