Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

SubtractDuration Function

Overview

The SubtractDuration function subtracts an ISO duration string from an ISO-8601 formatted date/time and returns an ISO-8601 date/time..

Syntax/Parameters

Syntax

string = SubtractDuration ( string value, string bias );

Parameters

value

A string in ISO-8601 format. The format need not contain the time.

bias

An string containing a formatted ISO duration such as P1D or P1Y1M.

Return Value

Returns a string as an adjusted ISO-8601 date or an empty string on failure. Use the GetLastError function to retrieve a formatted error code. The most common error is a format or syntax error in the source value parameter.

Remarks

The SubtractDuration applies the date/time adjustment in two modes: (1) values of days or lesser fraction are added via seconds math while (2) months and years are added a whole units. As such adding P90D is not the same as subtracting P1M. The value 90 days is not exactly three months.

When subtracting months, if the day of the month is at the end of the month, the last day of the month will be adjusted accordingly. For example, P3M on 06-30 will result in 03-31, not 03-30.

Related Functions 

Platform Support

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

Legato IDE, Legato Basic