fun confrontoDate(data1:String,data2:String): String { var esito = "" var errore = false val sdf0 = SimpleDateFormat("yyyy-MM-dd") var data1format = formattaData(data1) var data2format = formattaData(data2) var data1GC = GregorianCalendar() var data2GC = GregorianCalendar() try { data1GC.setTime(sdf0.parse(data1format)) } catch (e:Exception) { errore = true } // try { data2GC.setTime(sdf0.parse(data2format)) } catch (e:Exception) { errore = true } if (!errore) { if (data1GC.before(data2GC)) esito = data1 + " ante " + data2 if (data1GC.after(data2GC)) esito = data1 + " post " + data2 if (data1GC.equals(data2GC)) esito = data1 + " = " + data2 } else esito = "dati errati " +data1 +"/"+ data2 return esito }