FORMAT

Description

Returns a value formatted with the specified format and optional culture (FORMAT in Transact-SQL).

Sample Source Pattern

Syntax

FORMAT( value, format [, culture])

Arguments

value: String expressions to give format.

format: Desired format.

culture (Optional): NVarchar argument specifying culture. If it is not specified, takes the languages of the current session.

Return Type

NULL if the culture parameter is invalid, otherwise, it follows the next data types:

Category.NET type

Numeric

bigint

Int64

Numeric

int

Int32

Numeric

smallint

Int16

Numeric

tinyint

Byte

Numeric

decimal

SqlDecimal

Numeric

numeric

SqlDecimal

Numeric

float

Double

Numeric

real

Single

Numeric

smallmoney

Decimal

Numeric

money

Decimal

Date and Time

date

DateTime

Date and Time

time

TimeSpan

Date and Time

datetime

DateTime

Date and Time

smalldatetime

DateTime

Date and Time

datetime2

DateTime

Date and Time

datetimeoffset

DateTimeOffset

Examples

SELECT FORMAT(CAST('2022-01-24' AS DATE), 'd', 'en-gb')  AS 'Great Britain';
SELECT FORMAT(244900.25, 'C', 'cr-CR')  AS 'CURRENCY';

Known Issues

No issues were found.

No related EWIs.

Last updated