DATETIMEFROMPARTS (TSQL Function)

Returns a datetime created from the specified parts.

Syntax

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

Arguments

year
is an expression of type int.
month
is an expression of type int.
day
is an expression of type int.
hour
is an expression of type int.
minute
is an expression of type int.
seconds
is an expression of type int.
milliseconds
is an expression of type int.

Return Types

Returns datetime.

Examples

PRINT DATETIMEFROMPARTS (2016, 5, 15, 13, 30, 15, 500);

The result is:

2016-05-15 13:30:15.500000000
RSQL, a simple alternative to Microsoft SQL Server