In SQL Server, the FORMAT()
function enables you to format date/time and number values as a formatted string by passing in a “format string” as the second argument (the first argument is the value that’s being formatted).
Here’s an example of this function in action:
FORMAT(@date, 'dd/MM/yyyy');
In this case the format string is dd/MM/yyyy.
This particular format string specifies that the @date
value should be formatted with a two-digit day, two-digit month, and a four-digit year, in that order, and with forward slashes as the separators.
This would result in something like this:
21/05/2019
Continue reading →