Hello,

I'm refering to my previous post : Convert Number (elapsed_time) into Time (HH:MM:SS)

I have some issue that i don't understand with the scripted field from angelo response. This time I have a number in Seconds and I want it to be a duration like that hh:mm:ss (in my previous topic i had number in milliseconds)

I have come with this

```
if (doc['duration'].size()==0) {
return ""
} else {
long elapsed_time=(long)doc["duration"].value;
long minutesInseconds = 60;
long hoursInseconds = minutesInseconds * 60;
// long daysInMilli = hoursInMilli * 24;
// long elapsedDays = elapsed_time / daysInMilli;
// elapsed_time = elapsed_time % daysInMilli;
long elapsedHours = elapsed_time / hoursInseconds;
elapsed_time = elapsed_time % hoursInseconds;
long elapsedMinutes = elapsed_time / minutesInseconds;
elapsed_time = elapsed_time % minutesInseconds;
long elapsedSeconds = elapsed_time;
String my_answer = String.format("%02d:%02d:%02d", new def[] {(int)elapsedHours, (int)elapsedMinutes, (int)elapsedSeconds});
return my_answer;
}
```

But for example if i set 7200 second (2 hours) it's displayed like that 00:00:02 instead of 02:00:00

Can tell me where is my mistake here because I don't understand ?

In my scripted field i have correctly set up my number like this :

Thank you for help

Thibaut