In SQL Server, you can use the FORMAT()
function to format date/time and number values as strings. In particular, the function provides “locale-aware” formatting, and the function accepts a “culture” argument, which allows you to specify a culture or language to use for the actual format. For example, you can pass en-us
to ensure the results are formatted in US English format.
The culture argument is optional, so if you don’t provide it, the output will be determined by the language of the current session.
The FORMAT()
function accepts any culture supported by the .NET Framework as an argument (you’re not limited to the languages explicitly supported by SQL Server).
One of the cultures supported by the .NET Framework is the invariant culture. The invariant culture is culture-insensitive. More specifically, this culture is associated with the English language but not with any country/region.
To specify that FORMAT()
should output the results using the invariant culture, simply use "iv"
for the culture argument (the third argument).
Continue reading →