JavaScript method: XMLDate.toSCDuration()

This method converts an ISO 8601 duration string to an ITSMA Service Management 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 Management duration string.

Return values

A string or null.

The method returns a Service Management 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 Management 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 Management duration is: " + smDur );