DATETIMEFROMPARTS Function was introduced with SQL Server 2012. This function is used to get DateTime value from Year, Month, Day, Hour, Minute, Second and MiliSecond values.
DATETIMEFROMPARTS (Year, Month, Day, Hour, Minute, Second, MiliSecond)
Declare @Year int = 2015 Declare @Month int = 6 Declare @Day int = 9 Declare @Hour int = 23 Declare @Minute int = 59 Declare @Second int = 59 Declare @MiliSecond int = 0 Select DATETIMEFROMPARTS (@Year, @Month, @Day, @Hour, @Minute, @Second, @MiliSecond)
June, 09 2015 23:59:59