Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

UCCX convert seconds to hh:mm:ss

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?

Everyone's tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
New Member

If you are using UCCX

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

3 REPLIES
New Member

If you are using UCCX

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

New Member

This worked flawlessly.  Many

This worked flawlessly.  Many thanks!

 

Dale

New Member

Thanks very much Henry.  I

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
 

353
Views
0
Helpful
3
Replies
CreatePlease login to create content