> lang > format | ![]() |
| Documentation |
|
String = Format$ ( Expression [ , Format ] ) String = Format ( Expression [ , Format ] )
Converts the Expression to a String by using a format that depends on the type of the Expression .
This function can format dates, times, numbers, and currencies.
Format can be a predefined format (an Integer constant) or a user-defined format (a String that depicts the format) or can be omitted.
See Predefined Constants for a list of predefined formats.
If Format is not specified, gb.Standard is used.
![]() | This function uses localization information. |
A user-defined format is described by a sequence of special characters.
Arbitrary characters specified before and after the format strings will be printed as is
| + | Prints the sign of the number. | ||
| - | Prints the sign of the number only if it is negative. | ||
| # |
Prints a digit only if necessary.
| ||
| 0 | Always prints a digit, padding with a zero if necessary. | ||
| . | Prints the decimal separator. | ||
| , | Prints the thousand separators. | ||
| % | Multiplies the number by 100 and prints a per-cent sign. | ||
| E | Introduces the exponential part of a Float number. The sign of the exponent is always printed. |
| $ | Prints the national currency symbol. |
| $$ | When the $ is doubled, the international currency symbol is printed instead. |
| ( | Prints the representation of negative currencies. This must be the first character of the format. You can specify a closed brace ) at the end of the format. |
| yy | Prints the year on two digits. |
| yyyy | Prints the year on four digits. |
| m | Prints the month. |
| mm | Prints the month on two digits. |
| mmm | Prints the month in an abbreviatted string form. |
| mmmm | Prints the month in its full string form. |
| d | Prints the day. |
| dd | Prints the day on two digits. |
| ddd | Prints the week day in an abbreviated form. |
| dddd | Prints the week day in its full form. |
| / | Prints the date separator. |
| h | Prints the hour. |
| hh | Prints the hour on two digits. |
| n | Prints the minutes. |
| nn | Prints the minutes on two digits. |
| s | Prints the seconds. |
| ss | Prints the seconds on two digits. |
| : | Prints the time separator. |
| u | Prints the milliseconds, if they are different from zero. |