Im trying to add time to my KML file and I have no idea how to add. I know that according to the format I need to add it before the coordinates but I cant find the right command.. Help would be much appreciated =) This is the code I have so far:
String time=filteredStrings.get(i).get(4);
String timestamp=TimeConvert(time); // a function to get the right time format
String Location=filteredStrings.get(i).get(1)+","+filteredStrings.get(i).get(0);
doc.createAndAddPlacemark().withName("point"+i).withOpen(Boolean.TRUE).createAndSetTimeStamp().addToObjectSimpleExtension(timestamp)
.createAndSetPoint().addToCoordinates(Location);
The createAndSetTimeStamp() method returns a TimeStamp object not the placemark so setting the location after creating timestamp does not work.
Simply create a placemark object then set the location and time on it.
Placemark place = doc.createAndAddPlacemark().withName("point1")
.withOpen(Boolean.TRUE);
place.createAndSetPoint().addToCoordinates(Location);
place.createAndSetTimeStamp().withWhen("2017-11-22T00:00:00Z");