Customizing Presentation > Customizing the Duration Display Format
Customizing the Duration Display Format
Duration is displayed in two locations in the ThingWorx Apps:
Asset Advisor
Screenshot highlighting the duration display on an Asset in Asset Advisor.
Alert Monitoring—
Screenshot highlighting the duration display in Alert Monitoring.
Duration is displayed in the following format:
For times greater than 1 day, in days and hours: 6 days 3 hrs
For times greater than 1 hour, in hours and minutes: 3 hrs 27 mins
For times greater than 1 minute, in minutes and seconds: 1 min 42 secs
For times greater than or less than 1 second, in seconds and milliseconds: 6 secs 78 ms, or 0 secs 12 ms
* 
Milliseconds only display when the includeMS input on the service implementation is set to true. By default, includeMS is set to false.
To customize the format for displaying duration:
1. In ThingWorx Composer, open the PTC.SCA.SCO.TimeFormatHelper Thing.
2. Under Services, find the FormatDuration service and click Override service icon to override and edit the service.
3. Enter custom Javascript code for your desired duration format. For example:
To display the duration in seconds only, in the format "## seconds":
result = duration/1000 + " seconds";
To display the duration in seconds and milliseconds using the includeMS input, in the format "## seconds ## milliseconds":
var numOfSeconds = Math.floor(duration / 1000);
var numOfMilliseconds = duration % 1000;

if (includeMS = true) {
// Show seconds AND milliseconds
result = numOfSeconds + " seconds " + numOfMilliseconds + " milliseconds";
}
if (includeMS = false) {
// Show only seconds
result = numOfSeconds + " seconds";
}
4. Click Save and Continue, then click Done to save the updates to the service.
5. Click Save to save the Thing.
You can verify your change in ThingWorx Composer by clicking Test for the FormatDuration service, or by viewing Asset Advisor or Alert Monitoring in ThingWorx Apps.
Was this helpful?