Description

Converts a date and time string into its internal system format.

Syntax

internal = IConv (expression, "DT [dateconv] [^[n[c] ] [timeconv] ] ")

Parameters

IConv (DT) accepts arguments for the following parameters.

ParameterDescription
expressionContains a string that evaluates to a date, some delimiter, and a time. The format of both date and time can be any that are accepted in the IConv Date (D) and IConv Time (MT) conversions. If the delimiter between the date and the time is not a space, the c option must be used.

A space can be used as a delimiter either between the date and the time string, or within the time string, but not in both. For example, this string is valid for the IConv DT function: 01 JAN 2009 10:00 because although the delimiter between the date and time is a space, a colon is used in the time string.

For the date portion of expression, you can enter the month as a number, an abbreviation, or fully spelled out. If you abbreviate or spell out the month, you must use the exact spelling (including punctuation, if any).

If the time portion of expression is in 12-hour format, you must use the abbreviations found in the default language set (AM and PM).

DTIndicates the datetime conversion. If no options are specified, the conversion "DT^1" is assumed.

Options are allowed, but only the c option has meaning in the IConv function. Other options have meaning in the OConv function. They are accepted for input in the IConv function to allow the same specifications for both input and output. (Refer to OConv DateTime (DT) for more information.)

dateconvCan be any valid date conversion documented under IConv Date (D).

Do not include the "D" in the dateconv expression. Include only the optional parameters.

^ (caret)Use the ^ (caret) symbol to delimit the date conversion specification from the time conversion specification.
NSpecifies the number of characters that will separate the date from the time. The default is one. This number is ignored in the IConv function.
CIf a character other than a space is used to delimit the date from the time in expression, the delimiter character must be specified in c. The number of spacing characters is ignored, but the actual character must appear in c.
timeconvAny valid time conversion as documented under the topic IConv Time (MT). Do not include the "MT" in the timeconv expression. Include only the optional parameters.

Remarks

The datetime conversion creates a decimal number that represents the number of days (plus fractional 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.

Date and time zero (12/31/1967 at midnight) is used as the absolute measure for calculating the fractional value of a day. This means that for negative dates (earlier than the reference date) the fractional portion of the day increases as it gets earlier in the day, since this is further away from midnight.

For example, if the date and time is February 19, 2009, at 6:00AM, the internal format is 15026.25 (the .25 indicates one-quarter of the day). The date and time February 19, 1967, at 6:00PM appears as -314.25. Note that 6:00PM appears as .25 for dates previous to December 31, 1967.

See Also

Date()OConv DateTime (DT)

Example

The following examples illustrate how to convert date and time values to internal format.

testVal = IConv("02/19/2009 06:00AM","DT")     ; * testVal = 15026.25
testVal = IConv("02/19/2009 02:00AM", "DT")    ; * testVal = 15026.0833
testVal = IConv("02/19/2009 12P", "DT")        ; * testVal = 15026.5
testVal = IConv("02/19/1967 06:00AM", "DT")    ; * testVal = -314.75
testVal = IConv("02/19/1967 06:00PM", "DT")    ; * testVal = -314.25
testVal = IConv("02/19/1967-06:00PM", "DT^3-") ; * testVal = -314.25
  • No labels