U_DCDTIM

Decode an alpha time string into its numeric components

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
xcall U_DCDTIM(status, [string], [D_NOW], hour, minute[, second])

status

Returned with the decoding status (zero if valid, non-zero if not). (n)

string

(optional) The time string to convert to numeric form. (a)

D_NOW

(optional) Specifies that the time should default to the current system time if string is passed and blank. (n)

hour

Returned with the converted hour. (n)

minute

Returned with the converted minute. (n)

second

(optional) Returned with the converted second. (n)

U_DCDTIM decodes an alpha time string into separate numeric values for hour, minute, and second.

If you don’t pass string, the current system time will be returned and D_NOW, if passed, will be ignored.

String can be either numeric or delimited. A delimited time string has any number of non-digit characters separating each of the time’s components.

If string is a numeric string containing one or two digits, UI Toolkit considers it to be the hour. If it contains three or four digits, it is considered to be the hour and minute. (The rightmost two digits will be the minute, and the leftmost digits will be the hour.) If five or more digits are present, they are considered to be the hour, minute, and second. The rightmost two digits will be the second, the next two digits are the minute, and the leftmost digits are the hour.

If string is delimited, and if any component of the time is missing, the missing part will be assumed to be zero. If one of the non-numeric components is the post-meridian indicator (pm), twelve hours will be added to the time specified.

The post-meridian indicator is the text defined in the UI Toolkit message file as facility name DTK, mnemonic PM. It is not case sensitive. As distributed, this is set to “PM.” Any abbreviation of this text will be recognized. Thus “1:45p” will be recognized as 13:45 military time, so long as the text file entry for PM starts with a ‘p’ (uppercase or lowercase).

The following example decodes the time string in time to the form HHMMSS and returns the HH value in hr, and the MM value in mn. The SS value is ignored. (For example, if time contains “03:45 pm,” hr will be returned with 15, and mn will be returned with 45.) Sts will contain the decoding status.

xcall u_dcdtim(sts, time,, hr, mn)

The next example decodes the current system time to the form HHMMSS and returns the HH value in hr, the MM value in mn, and the SS value in sc.

xcall u_dcdtim(sts,, D_NOW, hr, mn, sc)