Skip to main content
Omnitracs Knowledge Base

Convert GMT Seconds to Date Time Given a Place - OMGMT2DP

Convert GMT Seconds to Date/Time Given a Place (OMGMT2DP)

Required Parameter Group:

1 GMT Seconds Input Packed(13,0)
2 Place Identifier Input Packed(7,0)
3 Place Alias Input Char(10)
4 Place Name Input Char(25)
5 Place State Abbreviation Input Char(2)
6 Place Country Abbreviation Input Char(2)
7 Date/Time Format Input Char(4)
8 Include Separators Input Char(1)
9 Date/Time Length Type Input Char(1)
10 Date/Time String Output Char(50)
11 Return Status Output Char(1)

API Overview:
The Convert GMT Seconds to Date/Time Given a Place API (OMGMT2DP) allows you to convert GMT seconds to a valid date/time string in the time zone appropriate for a specific place. A place may be specified by one of three ways: by place ID, by place alias, or by place name/state/country. These three ways are mutually exclusive.

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) Place Identifier
INPUT; PACKED(7,0)
This parameter contains a place identifier. If entered, the time zone and daylight savings flag for this place identifier are retrieved and used to when converting from GMT seconds to a date/time string.

(3) Place Alias
INPUT; CHAR(10)
This parameter contains a place alias. If entered, the time zone and daylight savings flag for the first place with this alias is retrieved and used to when converting from GMT seconds to a date/time string.

(4) Place Name
INPUT; CHAR(25)
This parameter contains a place name. If entered, the time zone and daylight savings flag for this place name is retrieved and used to when converting from GMT seconds to a date/time string. If this parameter is entered, then a valid place state and country abbreviation must also be specified.

(5) Place State Abbreviation
INPUT; CHAR(2)
This parameter contains a place state abbreviation. This parameter is used in conjunction with the Place Name and Place Country Abbreviation parameters.

(6) Place Country Abbreviation
INPUT; CHAR(2)
This parameter contains a place country abbreviation. This parameter is used in conjunction with the Place Name and Place State Abbreviation parameters.

(7) 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

(8) 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

(9) 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, & time zone)

(10) Date/Time String
OUTPUT; CHAR(50)
This parameter returns the left-justified converted date string in the format specified by the input parameters.

(11) Return Status
OUTPUT; CHAR(1)
Status value returned to the caller will be set as follows:

0 Success, date returned
1 Failure, error encountered
2 Failure, cannot resolve place using specified parameters

Return Formats
The following table provides examples of the format of the returned date/time based on the values specified in the various input parameters. Note that the time zone in the returned Date/Time String (ZZZZ in the examples) are time zone abbreviations such as ' EDT', ' EST', ' PDT', or ' PST', whereas the Convert to Time Zone parameter is a 3 character code (000-047) identifying a region such as Eastern or Pacific.

Format Separator Length Format of Returned Date/Time & Zone (OUTDAT)
*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

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
  • Was this article helpful?