Returns the character representation of expr based on the fmt string or the default for expr's data type. If expr is already a character string, expr is not converted.
If expr is a numeric value, fmt can be:
|%||Percent sign at right of number|
|$||Dollar sign at left of number|
|B||Display zero as blank|
|0||Display leading zeros|
|9||A digit position|
|other||Delimiting character (not leading)|
The default mask is as many nines (9s) as required for the number's precision and scale.
If expr is a date value, fmt can be:
|RR||Two-digit year in another century|
|MM||Two-digit month of year (01 to 12)|
|MON||Three-character month (all uppercase)|
|mon||Three-character month (all lowercase)|
|Mon||Three-character month (initial cap)|
|MONTH||Fully named month (all uppercase)|
|month||Fully named month (all lowercase)|
|Month||Fully named month (initial cap)|
|DDD||Three-digit day of year (001 to 356)|
|DD||Two-digit day of month (01 to 31)|
|D||Single-digit day of week (1 to 7)|
|DY||Three-character day (all upper case)|
|dy||Three-character day (all lowercase)|
|Dy||Three-character day (initial cap)|
|DAY||Fully named day (all uppercase)|
|day||Fully named day (all lowercase)|
|Day||Fully named day (initial cap)|
|HH12||Two-digit hour (00 to 11)|
|HH,HH24||Two-digit hour (00 to 23)|
|MI||Two-digit minutes (00 to 59)|
|SS||Two-digit seconds (00 to 59)|
|SSSSS||Seconds past midnight (0000 to 86399)|
|Q||Single-digit quarter of year (0 to 4)|
|W||Single-digit week of month (1 to 4); the week begins on Sunday|
|WW||Two-digit week of year (01 to 52)|
To add character extensions to the values that represent counting, such as ST, ND, RD, or TH, simply add th to any uppercase digit mask. The function correctly interprets the extension based on the last digit and the case based on the mask's case.
Put embedding characters that are valid masks inside double quotes (" ").
The default mask is DD-MON-YY.