SECS

SECS returns a FLOAT BINARY(53) value that is the number of seconds (based on Lilian format) corresponding to the date d.

Read syntax diagramSkip visual syntax diagram
>>-SECS--+--------------------------+--------------------------><
         '-(-+------------------+-)-'   
             '-d--+-----------+-'       
                  '-,p-+----+-'         
                       '-,w-'           

d
A string expression representing a date. If present, d specifies the input date as a character string representing the date/time specified in the pattern p. If d is missing, it is assumed to be DATETIME().

d must have a computational type and should have character type. If not, it is converted to character.

p
One of the supported date/time patterns. If p is omitted, it is assumed to be the default date/time pattern 'YYYYMMDDHHMISS999'.

p must have a computational type and should have character type. If not, it is converted to character.

w
Specifies an expression (such as 1950) that can be converted to an integer. If negative, it specifies an offset to be subtracted from the value of the year when the code runs. If omitted, w defaults to the value specified in the WINDOW compile-time option.

The allowed patterns are listed in Table 2. For an explanation of Lilian format, see Date/time built-in functions.

Example

  dcl Dayname (7) char(9) var
static nonasgn init( 'Sunday',
                                                   'Monday',
                                                   'Tuesday',
                                                   'Wednesday',
                                                   'Thursday',
                                                   'Friday',
                                                   'Saturday');
  dcl Jul4_1776_Secs float bin(53);
  dcl Age_Tot_Secs pic 'Z,ZZZ,ZZZ,ZZZ,ZZ9';

  Jul4_1776_Secs = secs('17760704','YYYYMMDD');     /* seconds */
  Age_Tot_Secs   = secs() - Jul4_1776_Secs;   /* seconds since */
  display ('USA became independent on ' ∥
            dayname(weekday(secstodays(Jul4_1776_Secs))) ∥
           ', July 4, 1776 and at this very moment it has been ' ∥
           Age_Tot_Secs, ∥     ' seconds.');





Published: 23 December 2018