Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter FiveGeneral Functions (continued)

StringToDate Function

Overview

The StringToDate function converts a formatted date string to date-time qword value.

Syntax/Parameters

Syntax

qword  = StringToDate ( string source, [dword format] );

Parameters

source

A string containing a date and or time the format of which is dictated by the format parameter.

format

An optional dword specifying the format of the incoming data. See Remarks below. The default value is SD_ISO_8601.

Return Value

Returns a qword containing a file time value or 0 on failure. Use the GetLastError function to return a formatted error code. The most common error is ERROR_SYNTAX or ERROR_RANGE. The lower byte, if non-zero, will specify the field number of the failure.

Remarks

The StringToDate function expects the date (and time) to be well formatted in one of three modes.

  Definition   Bitwise   Description  
  Modes          
    SD_PARSEMODE   0x0000000F   String Parse Mode Mask (select one)  
    SD_AMERICAN   0x00000000   String is American (mm/dd/yy)  
    SD_EUROPEAN   0x00000001   String is European (dd/mm/yy)  
    SD_ISO_8601   0x00000002   String is ISO-8601  
    SD_RFC_2822   0x00000003   String is RFC-2822 (Internet Message Format)  
  Options          
    SD_PARTIAL   0x00010000   String Can be Partially Formatted  

 

Delimiters can be dashes, slashes or periods. Spelled months are allowed. The mode flag must set the ordering to resolve ambiguous mm/dd or dd/mm for American versus European dates.

Note that any partial values will be truncated to the closest date. For example, “2020” becomes “2020-01-01 00:00:00”. Time only values are still in 100 nanosecond intervals from Jan 1, 1601, as such if converted to a date, they will be prefixed with that date.

Related Functions

Platform Support

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

Legato IDE, Legato Basic