print dates in GEE

When were these pictures taken?

Step 1: Import the sentinel-2 image collection. Give it the name s2

Step 2: Add a marker at your location of interest.

Step 3: Add the code below:

// filter for the location
var f = s2.filterBounds(geometry);

// print the number of files
print(f.size());

// put all dates in a list
var dates = ee.List(f.aggregate_array("system:time_start"))
    .map(function(d) { return ee.Date(d)});

// print a list with dates
print(dates);

See an example here!

Leave a Reply