04-21-2014 12:09 PM - edited 03-19-2019 08:07 AM
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?
Solved! Go to Solution.
04-21-2014 06:05 PM
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
04-21-2014 06:05 PM
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
04-22-2014 07:55 AM
This worked flawlessly. Many thanks!
Dale
01-03-2018 03:40 PM
Am I missing something or would this require a TTS server to work?
04-21-2014 06:31 PM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide