# Internal format

Internal format is the data format resulting when data
is internally converted using one of the conversion or processing
codes provided with D3. As a general rule, internal format refers
to the manner in which data is stored inside the system.

The main advantage of an internal format is that it takes
much less time to compare two values.

For example, time values
are not stored in external form. Rather, they 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, which would be 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 easily
manipulated if stored in an internal format. An input processing code
of d takes an external date, uses a calculation to determine the number
of days that have elapsed since December 31, 1967 (day 0 on the D3
calendar), and stores an internal julian date. A similar output processing
code converts an internal date to its external form.

In addition,
numerical values are easily handled by the system if they are all
stored as integer amounts, and the decimal point (if any) is inserted
only upon output. A typical 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.

Another 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 are reconstituted upon output.

## See also

- [d (date) processing code](https://d3codex.com/processingcodes/d-date-processing-code/)
- [External format](https://d3codex.com/definitions/external-format/)
- [mt (mask time) processing code](https://d3codex.com/processingcodes/mt-mask-time-processing-code/)
- [Processing codes overview](https://d3codex.com/processingcodes/processing-codes-overview/)

---
Source: https://d3codex.com/definitions/internal-format/ - part of the D3Codex reference.
