TIME
Estimated reading time: 3 minutes
Accesses the system time of day at any time during program processing. The system time is based on the 24-hour clock.
TIME
Target (Numeric | Date | Time | Timestamp)
Type (*ZONED | *PACKED | *BINARY | *DATE | *TIME | *TIMESTAMP)
Len (Length Integer [, Decimal Integer])
ResultTimFmt(<u>*ISO</u> | *DMY | *EUR | *JIS | *JUL | *MDY | *USA | *YMD)
Parameters
Target
Required. Specifies the field into which the time of day or the date and time of day are written.
Type
Optional. Can be any of the Types listed. See Type Parameter for further information. If the field specified in Target is to be declared in this command then at least one of Type or Len must be given. If Type is not given the type will be *ZONED and Len must contain a list describing its digits and decimals.
Len
Optional. Defines the length of the field. It is required if Type represents one of the fixed-decimal types.
ResultTimFmt
Optional. Specifies the format of the result, if the result is a numeric field. The default is *ISO .
Remarks
The result value will depend on the type of the Target field and on the time format specified in the ResultTimFmt parameter, according to the following table:
Target </td> | Value Returned </td> |
Returned Format
</td>
</tr>
6-digit </td>
|
Numeric </td>
|
Time hhmmss </td>
</tr>
|
12-digit </td>
|
Numeric </td>
|
Time and Date, two-digit year </td>
</tr>
|
14-digit </td>
|
Numeric </td>
|
Time and Date, four-digit year </td>
</tr>
|
Time </td>
|
Time </td>
|
Format of Result </td>
</tr>
|
Date </td>
|
Date </td>
|
Format of Result </td>
</tr>
|
Timestamp </td>
|
Timestamp </td>
|
Format of Result </td>
</tr>
</table>
If **Target** is a numeric field, to access the time of day only, specify **Target** as a 6-digit numeric field.
To access both the time of day and the system date, specify **Target** as a 12 (2-digit year) or 14-digit (4-digit year) numeric field. The time of day is always placed in the first six positions of **Target** in the following format:
hhmmss (hh=hours, mm=minutes, and ss=seconds)
- If **Target** is a numeric field, then if the system date is included, it is placed in **Target** following the time. The format for the date part depends on the value of **ResultTimFmt** , with *ISO (yyMMdd or yyyyMMdd) as the default. If *JUL is specified as the desired format then the date part will be the year (2- or 4-digits) followed by the 3-digit day, followed by a zero (yyddd0 or yyyyddd0).
- If **Target** is a Timestamp field, the last 3 digits in the microseconds-part are always 000.
| |