T-SQL Tutorial

T-SQL SET Dateformat


SET Dateformat - sets the order of the month, day, and year date parts.

SET Dateformat Syntax:

SET DATEFORMAT { format | @format_variable } ;

SET Dateformat Example:

SET DATEFORMAT dmy;
GO
DECLARE @date_variable datetime2 = '31/08/2014 10:11:43.1234567';
SELECT @date_variable;
GO

Result:
2014-08-31 10:11:43.1234567