Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter FiveGeneral Functions (continued)

DurationToTimeComponents Function

Overview

The DurationToTimeComponents function converts a formatted duration string and returns a list of time components. For example, “P1M” returns one month.

Syntax/Parameters

Syntax

int [] = DurationToTimeComponents ( string duration );

Parameters

duration

A string containing an XML/ISO-8601 formatted duration string.

Return Value

Returns an int array containing the time components or an empty array on failure. Use the GetLastError function to retrieve error information.

Remarks

Unlike DurationToComponents, this function converts the specified items into average values and then fills a standard time list using Windows system time values.

The returned array elements are named as follows:

  Key Name   Description  
  Negative   Present and set to non-zero if the string was preceded by a dash (‘-’) symbol.  
  Year   Year value.  
  Month   Month value.  
  DayOfWeek  

Day of week value. The first day is 0, or Sunday, while the last is 6, or Saturday. Note this is only valid when getting components from a date-time qword value as opposed to a date string. There is no way of differentiating an empty index from Sunday. The days are defined in the SDK.

DOW_SUNDAY     —  0

DOW_MONDAY     —  1

DOW_TUESDAY    —  2

DOW_WEDNESDAY  —  3

DOW_THURSDAY   —  4

DOW_FRIDAY     —  5

DOW_SATURDAY   —  6

 
  Day   Day of month value.  
  Hour   Hour value. Value will be zero if not included in the incoming value parameter.  
  Minute   Minute value. Value will be zero if not included the incoming value parameter.  
  Second   Second value. Value will be zero if not included the incoming value parameter.  
  Milliseconds   Milliseconds value. Value will be zero if not included the incoming value parameter.  

 

If a value is not specified, the key name will not be present in the list.

To set the values in the array, simple math functions are performed using average values, for example not all months are 30 days. Since there is no reference date, averages must be employed.

Related Functions 

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic