DATE_AND_TIME(DATE, TIME, ZONE, VALUES)

Purpose

Returns data from the real-time clock and the date in a form compatible with the representations defined in ISO 8601:1988.

Class

Subroutine

Argument type and attributes

DATE (optional)
An INTENT(OUT) CHARACTER scalar that has a length of at least eight. Its leftmost eight characters are set to a value of the form CCYYMMDD, where CC is the century, YY is the year within the century, MM is the month within the year, and DD is the day within the month. If no date is available, these characters are set to blank.
TIME (optional)
An INTENT(OUT) CHARACTER scalar that has a length of at least ten. Its leftmost ten characters are set to a value of the form hhmmss.sss, where hh is the hour of the day, mm is the minutes of the hour, and ss.sss is the seconds and milliseconds of the minute. If no clock is available, they are set to blank.
ZONE (optional)

An INTENT(OUT) CHARACTER scalar that has a length of at least five. Its leftmost five characters are set to a value of the form ±hhmm, where hh and mm are the time difference with respect to Coordinated Universal Time (UTC) in hours and the parts of an hour expressed in minutes, respectively. If no clock is available, they are set to blank.

IBM extension begins The value of ZONE may be incorrect if you have not set up the machine through the smit chtz fastpath, or if you are in a timezone not configurable through smit. You can manually set the TZ environment variable or use the chtz command to ensure the time zone is correctly set up. The format of the TZ variable is documented under the /etc/environment file in the AIX® Files Reference. IBM extension ends

VALUES (optional)
An INTENT(OUT) INTEGER of rank one. Its size must be at least eight. The values returned in VALUES are as follows:
VALUES(1)
is the year (for example, 1998), or -HUGE (0) if no date is available.
VALUES(2)
is the month of the year, or -HUGE (0) if no date is available.
VALUES(3)
is the day of the month, or -HUGE (0) if no date is available.
VALUES(4)
is the time difference with respect to Coordinated Universal Time (UTC) in minutes, or -HUGE (0) if this information is not available.
VALUES(5)
is the hour of the day, in the range 0 to 23, or -HUGE (0) if there is no clock.
VALUES(6)
is the minutes of the hour, in the range 0 to 59, or -HUGE (0) if there is no clock.
VALUES(7)
is the seconds of the minute, in the range 0 to 60, or -HUGE (0) if there is no clock.
VALUES (8)
is the milliseconds of the second, in the range 0 to 999, or -HUGE (0) if there is no clock.

Examples

The following program:
INTEGER DATE_TIME (8)
CHARACTER (LEN = 10) BIG_BEN (3)
CALL DATE_AND_TIME (BIG_BEN (1), BIG_BEN (2), &
                    BIG_BEN (3), DATE_TIME)

if executed in Geneva, Switzerland on 1985 April 12 at 15:27:35.5, would have assigned the value 19850412 to BIG_BEN(1), the value 152735.500 to BIG_BEN(2), the value +0100 to BIG_BEN(3), and the following values to DATE_TIME: 1985, 4, 12, 60, 15, 27, 35, 500.

Note that UTC is defined by CCIR Recommendation 460-2 (also known as Greenwich Mean Time).