I'm implementing some services in JAVA to a call center. I need to record the duration of a call so I'm using this to do that:
last = Instant.now();
Duration duration = Duration.between(first, last);
tfinal=Timestamp.from(last);
Long minutos;
Long hours;
duracion = "00 horas y ";
minutos = duration.toMinutes();
if (minutos > 60) {
hours = duration.toHours();
duracion = hours.toString() + " horas y ";
}
duracion = duracion + minutos.toString() + " minutos";
Which works perfectly...the thing is I have a cancel button on my screen which cleans all my fields or reset them to 0....What I haven´t figure out is how to return my last variable to 0... or something that clears this field which contains my last Instant type variable. I can set to "" my duracion variable because it is a String...but how can I achieve this with my java.time.Instant variabale? I'm also using primefaces.