TIMEFROMPARTS (TSQL Function)

Returns a time created from the specified parts.

Syntax

TIMEFROMPARTS ( hour , minute , seconds , fractions , precision )

Arguments

hour
is an expression of type int.
minute
is an expression of type int.
seconds
is an expression of type int.
fractions
is the subsecond fractional part. It is of type int. Its precision is given by the precision argument.
precision
precision of the fractions argument. It is of type int, in the range [0, 9].
E.g. 3 means that fractions is specified as milliseconds; 9 is for nanoseconds.

Return Types

Returns time.

Examples

PRINT TIMEFROMPARTS(13, 30, 15, 0, 0);

The result is:

13:30:15

Example with fractions:

PRINT TIMEFROMPARTS(13, 30, 15,   5, 1); -- 5/10th   of a second
PRINT TIMEFROMPARTS(13, 30, 15,  50, 2); -- 5/100th  of a second
PRINT TIMEFROMPARTS(13, 30, 15, 500, 3); -- 5/1000th of a second

The result is:

13:30:15.500000000
13:30:15.500000000
13:30:15.500000000
RSQL, a simple alternative to Microsoft SQL Server