Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
FORMAT$ Function Details
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
FORMAT$(expression [,fmt$])
Usage Notes
■ If fmt$ is omitted or is a null string, FORMAT$ provides the same
functionality as the STR$ function - that is, it converts positive
numbers to strings. However, numbers converted to strings using FORMAT$
do not have the leading space reserved to display the sign of the value,
while numbers converted using STR$ retain the leading space. When no
display formatting is required, use STR$ to convert numbers to strings.
See: ◄STR$ Function►
■ A format expression (fmt$) can have up to three sections separated by
semicolons (;). The first section formats positive values, the second
section formats negative values, and the third section formats zeros:
Usage Result
════════════════ ══════════════════════════════════════════════
One section only The format applies to all numbers
Two sections The first section applies to positive numbers
and zeros; the second to negative numbers
Three sections The first section applies to positive numbers,
the second to negative numbers, and the third
to zeros
■ If you have semicolons with nothing between them, the missing section
prevents that type of number from being displayed.
■ Visual Basic supports international formatting styles under MS-DOS
version 3.31 or later.
■ Default settings for date and time formats are determined by the
operating system. See: ◄Date and Time Command Summary►