Skip to content

Latest commit

 

History

History
49 lines (30 loc) · 1.7 KB

DATE1-notes.md

File metadata and controls

49 lines (30 loc) · 1.7 KB

DATE1.CBL

This sample demonstrates how to obtain the current system date and time via the intrinsic function CURRENT-DATE.

Notes

The program uses FUNCTION CURRENT-DATE to get the current date and time values, and formats the date and time information in various ways.

Compared with the older method of using the ACCEPT statement to obtain system date and time values, the CURRENT-DATE function offers the advantage that it provides timezone offset information. However, it provides the time value only down to a precision of whole seconds. For a comparison with the ACCEPT method, please see the DATE2 sample program.

Example 1: NCSA common log format

The format looks like this:

[19/Jan/2021:05:51:04 -0800]

Example 2: Verbose date

The format looks like this:

January 19th, 2021

Example 3: US-style shorthand date

The format looks like this (representing January 19, 2021):

01/19/21

Example 4: European-style shorthand date

The format looks like this (representing January 19, 2021):

19.01.21

Additional information