What is a most straightfoward way to get a date range of an ee.ImageCollection as formatted date strings?

For example, ee.ImageCollection('LANDSAT/LT04/C01/T1_32DAY_EVI').get('date_range') returns [398044800000,756259200000], so first I need to cast both items into ee.Date and then format() or print() them to get 1982-08-13 and 1993-12-19, but I think there should be easier ways to estimate date range of a collection.

2 Answers 2


You will always require a lot of casting in the Earth Engine. Either way, does this met your needs? Works for most collections. Also note that it shows slight different dates than the one of the image collection property.

var date1 = imageCollection.sort('system:time_start',true).first().date()
var date2 = imageCollection.sort('system:time_start',false).first().date()
print(date1, date2)

For your specific collection, the date() function somehow does not work. Try this work around (with more casting :) ). Maybe someone from Google can elaborate on why?

var date1 = ee.Date(imageCollection.sort('system:time_start',true).first().get('system:time_start'))
var date2 = ee.Date(imageCollection.sort('system:time_start',false).first().get('system:time_start'))
print(date1, date2)

link code


This is a 2 lines alternative

var collection = ee.ImageCollection('LANDSAT/LT04/C01/T1_32DAY_EVI')
var range = collection.reduceColumns(ee.Reducer.minMax(), ["system:time_start"])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.