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

UCCX convert seconds to hh:mm:ss

dalewholloway
Beginner
Beginner

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
Beginner
Beginner

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
Beginner
Beginner

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
Beginner
Beginner

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
 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: