I have a featureCollection with the dates for 2021. I would like to do a date conversion for this featureCollection to get the same dates in 2017. I have written the function above but it returns the error. How can I solve this?
//Date conversion
print(swarms)
//Converting data parameter
function epoch2date(feature){
var epoch = feature.get('STARTDATE');
var date = ee.Date(epoch).format('YYYY-MM-dd');
return feature.set('date', date);
}
var swarmDates = swarms.map(epoch2date);
print(swarmDates)
//Compute dates in 2017
function dates(feature){
var date = swarmDates.get('date');
var newDate = ee.Date(date).advance(-4, 'year').format('YYYY-MM-dd');
return feature.set('newDate', newDate)
}
var dates2017 = swarms.map(dates);
print(dates2017)
The link to the code to is;https://code.earthengine.google.com/098d3ae0185833f573d8f3e372fc5160