guides:programming:programmers_reference_manual:oconv_datetime_dt

OConv DateTime (DT) function

Converts from internal storage format to a specified date and time format.

The fractional internal date represents the number of days since December 31, 1967, at midnight. As with the "D" conversion, this date has been chosen to represent day and time zero. Dates previous to December 31, 1967, appear as negative numbers.

output = OConv(expression, "DT[ dateconv] [ ^ [ n[ c]] [timeconv]]")

OConv (DT) takes the following arguments for its parameters.

ParameterDescription
expressionContains a decimal number with no punctuation other than a period. The whole number portion of the expression is assumed to be an internal date. The fractional portion of the expression is interpreted as a fractional portion of a day.

If the expression cannot be converted into a DateTime format, Status() is set to 1.
DT

- or -

DTX
Indicates the DateTime conversion. If no options are specified, the conversion "DT^1 " is assumed.

DTX is used for international default conversions. Requires that a language is set in the environment, in field 15 (@environ.set<ENV_LND_DEFAULT$> ), eg LND_GERMAN_D, LND_FRENCH_F, etc., etc., etc. The language needs to be set within the SYSENV record prior to start.
nSpecifies the number of characters that will separate the date from the time. The default is 1.
cUse c to specify a character used to separate the date from the time. The default is a space. Unless the timeconv starts with "H" or "S," c is required if n is specified.
timeconvAny valid time conversion as documented under the topic OConv Time (MT).

Do not include the "MT" in the timeconv expression. Include only the optional parameters.

X = OConv(15036, 'DT')        ; * Output is 01 MAR 2009 12:00.

X = OConv(15036, 'DT2^HS ')   ; * Output is 01 MAR 09 12 00 00PM.

X = OConv(15036, 'DT^3*/')    ; * Output is 01 MAR 2009***12/00.

X = OConv(15036, 'DT/^S')     ; * Output is 03/01/2009 12:00:00.

X = OConv(15036,'DT:^3H')     ; * Output is 03:01:2009  12:00AM.

X = OConv(15036.25,'DT/^3H')  ; * Output is 03/01/2009  06:00AM.

X = OConv(15036.75,'DT2/^H')  ; * Output is 03/01/2009 06:00PM.

* When the language is set to LND_FRENCH_F, the following is observed dd will contain 09:36

dd = Oconv(13525.400, 'DTX')
  • guides/programming/programmers_reference_manual/oconv_datetime_dt.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1