ICONV Function

The ICONV function may be used to convert an expression from external format to internal format, depending on the conversion code specified.

Format

ICONV(expr, code)

Parameter(s)

expr

An expression evaluating to the data to be converted.

code

An expression evaluating to the conversion code, as described below.

Description

The ICONV function converts data to internal format. It is intended for storing data which would be more consistent or more flexible in internal format.

For example, the internal format for the date is the number of days since December 31, 1967, which is considered day 0. All dates after December 31, 1967, are positive numbers representing the number of days that have elapsed since then. All dates prior to day 0 are negative numbers representing the number of days prior to this date.

When storing a date, it is preferable to store it in internal format and to make calculations on that date easier to perform. To convert back from internal format to external format, use the OCONV function.

The conversion codes for ICONV correspond to the codes used in INFO/ACCESS. Among the more common codes used in mvBASIC are:

D

Converts date to internal format.

MT[H][S]

Converts time to internal format.

H

12-hour format

S

Includes seconds

MX

Converts hexadecimal to ASCII representation.

Among the INFO/ACCESS codes that cannot be called by the ICONV function are F, A, and S.

Example

To convert the variable TIME into internal format, the code would read:

CURR.TIME = ICONV(CURR.TIME, "MT")

See Also

Statement and Function Reference