JavaScript method: XMLDate.toSCDuration()

This method converts an ISO 8601 duration string to an Service Manager duration string.

Syntax

XMLDate.toSCDuration( duration );

Arguments

The following arguments are valid for this function:

Argument Data type Required Description
duration ISO 8601 duration string Yes This argument contains the ISO 8601 duration string or variable value you want the script to convert to a Service Manager duration string.

Return values

A string or null.

The method returns a Service Manager duration string or null if the conversion fails.

Example

This example does the following:

  • Creates a new XMLDate object containing a hard-coded ISO date
  • Converts the ISO date/time to a Service Manager duration string
print( "Creating XMLDate object..." );
var d = new XMLDate( "P01DT12H01M01S" );
print( "The value of the new XMLDate object is: " + d );
print( "Converting " + d.toString() + " to a SC duration..." );
var smDur = d.toSCDuration();
print( "The Service Manager duration is: " + smDur );