In SQL Server, when you use the T-SQL FORMAT()
function to format a time data type, you need to remember to escape any colons or periods in your format string.
This is because the FORMAT()
function relies upon CLR formatting rules, which dictate that colons and periods must be escaped. Therefore, when the format string (second parameter) contains a colon or period, the colon or period must be escaped with backslash when an input value (first parameter) is of the time data type.