ee.DateRange.isEmpty
Returns true if this DateRange contains no dates (i.e. start >= end).
Usage | Returns |
---|
DateRange.isEmpty() | Boolean |
Argument | Type | Details |
---|
this: dateRange | DateRange | |
Examples
// A series of ee.DateRange objects.
var dateRange1 = ee.DateRange('2017-06-24', '2017-07-24');
var dateRange2 = ee.DateRange('2017-07-24', '2017-06-24');
var dateRange3 = ee.DateRange('2017-07-24', '2017-07-24');
// Determine if the ee.DateRange is empty.
print('Is dateRange1 empty?', dateRange1.isEmpty());
print('Is dateRange2 empty?', dateRange2.isEmpty());
print('Is dateRange3 empty?', dateRange3.isEmpty());
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
# A series of ee.DateRange objects.
date_range_1 = ee.DateRange('2017-06-24', '2017-07-24')
date_range_2 = ee.DateRange('2017-07-24', '2017-06-24')
date_range_3 = ee.DateRange('2017-07-24', '2017-07-24')
# Determine if the ee.DateRange is empty.
display('Is date_range_1 empty?', date_range_1.isEmpty())
display('Is date_range_2 empty?', date_range_2.isEmpty())
display('Is date_range_3 empty?', date_range_3.isEmpty())
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["The `DateRange.isEmpty()` method returns `true` if the DateRange object represents an empty time interval (i.e., the start date is equal to or later than the end date)."],["It can be applied to any `ee.DateRange` object to check its validity."],["If the start date is earlier than the end date, the DateRange is considered valid and the method returns `false`."],["When the start and end dates are the same, the `DateRange.isEmpty()` method will also return `true`, indicating an empty or instantaneous range."]]],["The `isEmpty()` method checks if a `DateRange` contains no dates. It returns a boolean value: `true` if the start date is greater than or equal to the end date, `false` otherwise. It operates on a `DateRange` object. Examples demonstrate creating `DateRange` objects and using `isEmpty()` to check their status, outputting the boolean result in both Javascript and python.\n"]]