cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1808
Views
5
Helpful
4
Replies

UCCX convert seconds to hh:mm:ss

dalewholloway
Level 1
Level 1

I have a need in a script to convert a get reporting statistic value from an integer value in seconds to hh:mm:ss format. I think I would do this with a set step, but I have not been able to properly reformat the data.  Can anyone help with the procedure to achieve this?

1 Accepted Solution

Accepted Solutions

hpugsley01
Level 1
Level 1

If you are using UCCX Enhanced or Premium then your best bet is to use some Java in a set() step:

Set StrTime = {

int hours = intSeconds / 3600;
int remainder = intSeconds % 3600;
int minutes = remainder / 60;
int seconds = remainder % 60;

return ( (hours < 10 ? "0" : "") + hours
+ ":" + (minutes < 10 ? "0" : "") + minutes
+ ":" + (seconds< 10 ? "0" : "") + seconds );

}

 

If you're using Standard .. I'll have to think about that one.

 

-Henry

View solution in original post

4 Replies 4

hpugsley01
Level 1
Level 1

If you are using UCCX Enhanced or Premium then your best bet is to use some Java in a set() step:

Set StrTime = {

int hours = intSeconds / 3600;
int remainder = intSeconds % 3600;
int minutes = remainder / 60;
int seconds = remainder % 60;

return ( (hours < 10 ? "0" : "") + hours
+ ":" + (minutes < 10 ? "0" : "") + minutes
+ ":" + (seconds< 10 ? "0" : "") + seconds );

}

 

If you're using Standard .. I'll have to think about that one.

 

-Henry

This worked flawlessly.  Many thanks!

 

Dale

Am I missing something or would this require a TTS server to work?

dalewholloway
Level 1
Level 1

Thanks very much Henry.  I hadn't even thought of a Java solution for this.  I've uploaded this and will test as soon as I've built up a queue tomorrow morning. 

 

Dale