External format describes data that has been externally converted using one of the conversion or processing codes provided with D3. As a general rule, external format means data is in a human-readable format.
The main advantage of an internal format is that it takes much less time to compare two values.
For instance, time values are converted using the mt input processing code, which takes a legal external time such as 14:00 (2:00 PM) and calculates the number of seconds past midnight for this value, resulting in the internal value. In this case, the internal form would be 50400. The same mt code used as an output processing code can be used to convert the internal value to its external form.
Dates are also more easily manipulated if stored in an internal format. An input processing code of d takes an external date, use a calculation to determine the number of days that have elapsed since December 31, 1967 (day 0 on the D3 calendar), and store an internal julian date. A similar output processing code converts an internal date to an external form.
In addition, numerical values are more easily handled by the system if they are all stored as integer amounts, and the decimal point (if any) is inserted only upon output. An American dollar amount (for example, $100.00) is converted upon input to an internal form of 10000 using the mr2 input processing code. A similar output processing code redisplays the figure as 100.00.
One final reason for using an internal format is to save storage space (for example, converting the external form of SMALL, MEDIUM, and LARGE into S, M, and L). The internal values can then be reconstituted upon output.
See Also