Convert GMT Seconds to Date Time - OMGMT2DT
Convert GMT Seconds to Date/Time (OMGMT2DT)
Required Parameter Group:
1 | GMT Seconds | Input | Packed(13,0) |
2 | Convert to Time Zone | Input | Char(1) |
3 | Date/Time Format | Input | Char(4) |
4 | Include Separators | Input | Char(1) |
5 | Date/Time Length Type | Input | Char(1) |
6 | Date/Time String | Output | Char(50) |
7 | Return Status | Output | Char(1) |
API Overview:
The Convert GMT Seconds to Date/Time API (OMGMT2DT) converts the input GMT seconds to a valid date/time and time zone as indicated by the input parameters.
Required Parameter Group Details:
(1) GMT Seconds
INPUT; PACKED(13,0)
This parameter must contain a valid date/time expressed in the number of whole seconds since January 1, 1988 in GMT time zone.
(2) Convert to Time Zone
INPUT; CHAR(1)
This parameter indicates whether the GMT Seconds should be converted to the system's time zone or the user's time zone. Valid values are:
S | System |
U | User |
(3) Date/Time Format
INPUT; CHAR(4)
This parameter contains the requested output format for the Date/Time String. Valid values are:
*MDY | Month, day, year format (MM/DD/YY) |
*DMY | Day, month, year format (DD/MM/YY) |
*YMD | Year, month, day format (YY/MM/DD) |
*JUL | Julian format (YY/JJJ) |
*JOB | Evaluates to one of the above |
(4) Include Separators
INPUT; CHAR(1)
This parameter indicates if the Date/Time String should include separators. Valid values are:
0 | Do not include separators |
1 | Include separators |
(5) Date/Time Length Type
INPUT; CHAR(1)
This parameter indicates the length type for the Date/Time String. Valid values are:
0 | Long (includes year, month, day, hours, minutes, seconds, & time zone) |
1 | Short (includes month, day, hours, minutes, & time zone) |
2 | Extra long (includes century, year, month, day, hours, minutes, seconds, &amamp; time zone) |
(6) Date/Time String
OUTPUT; CHAR(50)
This parameter returns the left-justified converted date string in the format specified by the input parameters.
(7) Return Status
OUTPUT; CHAR(1)
Status value returned to the caller will be set as follows:
0 | Success, date converted |
1 | Failure, error encountered |
Return Formats
The following table provides examples of the format of the returned date/time based on the values specified on the various input parameters.
Format | Separator | Length | Format of Returned Date/Time & Zone |
*YMD | 0 (no) | 1 (short) | MMDDHHMM ZZZZ |
*MDY | 0 (no) | 1 (short) | MMDDHHMM ZZZZ |
*DMY | 0 (no) | 1 (short) | DDMMHHMM ZZZZ |
*JUL | 0 (no) | 1 (short) | YYJJJ HHMMSS ZZZZ |
*YMD | 1 (yes) | 1 (short) | MM/DD HH:MM ZZZZ |
*MDY | 1 (yes) | 1 (short) | MM/DD HH:MM ZZZZ |
*DMY | 1 (yes) | 1 (short) | DD/MM HH:MM ZZZZ |
*JUL | 1 (yes) | 1 (short) | YY/JJJ HH:MM:SS ZZZZ |
*YMD | 0 (no) | 0 (long) | CYYMMDDHHMMSS ZZZZ |
*MDY | 0 (no) | 0 (long) | CMMDDYYHHMMSS ZZZZ |
*DMY | 0 (no) | 0 (long) | CDDMMYYHHMMSS ZZZZ |
*JUL | 0 (no) | 0 (long) | YYJJJ HHMMSS ZZZZ |
*YMD | 1 (yes) | 0 (long) | YY/MM/DD HH:MM:SS ZZZZ |
*MDY | 1 (yes) | 0 (long) | MM/DD/YY HH:MM:SS ZZZZ |
*DMY | 1 (yes) | 0 (long) | DD/MM/YY HH:MM:SS ZZZZ |
*JUL | 1 (yes) | 0 (long) | YY/JJJ HH:MM:SS ZZZZ |
*YMD | 0 (no) | 2 (extra long) | CCYYMMDDHHMMSS ZZZZ |
*MDY | 0 (no) | 2 (extra long) | MMDDCCYYHHMMSS ZZZZ |
*DMY | 0 (no) | 2 (extra long) | DDMMCCYYHHMMSS ZZZZ |
*JUL | 0 (no) | 2 (extra long) | CCYYJJJ HHMMSS ZZZZ |
*YMD | 1 (yes) | 2 (extra long) | CCYY/MM/DD HH:MM:SS ZZZZ |
*MDY | 1 (yes) | 2 (extra long) | MM/DD/CCYY HH:MM:SS ZZZZ |
*DMY | 1 (yes) | 2 (extra long) | DD/MM/CCYY HH:MM:SS ZZZZ |
*JUL | 1 (yes) | 2 (extra long) | CCYY/JJJ HH:MM:SS ZZZZ |
The following notes apply to the contents of the Date/Time String parameter on a successful conversion:
- If the Date/Time Length Type parameter is '0' or '1', then the time zone code (ZZZZ) is returned right-justified in positions 19-22.
- If the Date/Time Length Type parameter is '2', then the time zone code (ZZZZ) is returned right-justified in positions 21-24.
- If the Date/Time String is between 2:00 AM on the first Sunday in April, and 2:00 AM on the last Sunday in October, then the date/time is returned as daylight savings time in the specified zone (user or system). Otherwise, it is returned as standard time in the specified zone.
Valid Input GMT Seconds
The following table provides examples of the valid range of GMT Seconds that may be passed as input to this program. Values that are outside of these ranges will be rejected. The range of valid GMT Seconds is based on the Convert to Time Zone parameter.
Time Zone | Low End Valid GMT Seconds (All of which evaluate to 01/01/1988 at 00:00:00.) | High End Valid GMT Seconds (All of which evaluate to 12/31/2039 at 23:59:59.) |
Greenwich | 0000000000000 | 0001640995199 |
Eastern | 0000000018000 | 0001641013199 |
Central | 0000000021600 | 0001641016799 |
Mountain | 0000000025200 | 0001641020399 |
Pacific | 0000000028800 | 0001641023999 |