T-SQL Tutorial

DATETIMEFROMPARTS Date Function


Datetimefromparts is an date function and returns a datetime value for the specified date and time.

DATETIMEFROMPARTS Syntax:

DATETIMEFROMPARTS(year, month, day, hour, minute, seconds, milliseconds)

DATETIMEFROMPARTS Example:

SELECT DATETIMEFROMPARTS(2014, 2, 22, 8, 53, 39, 7) as Date_1,
DATETIMEFROMPARTS(2014, 2, 22, 8, 53, 39, 77) as Date_2,
DATETIMEFROMPARTS(2014, 2, 22, 8, 53, 39, 777) as Date_3;

Date_1Date_2Date_3
2014-02-22 08:53:39.0072014-02-22 08:53:39.0772014-02-22 08:53:39.777