New TIMEFROMPARTS Function in SQL Server 2012

In this article I have described new TIMEFROMPARTS function in SQL Server 2012.
  • 5324

TIMEFROMPARTS Function

The TIMEFROMPARTS function is used to return time values for the specified time and with the specified precision. The syntax of the TIMEFROMPARTS built-in date function is as follows: 

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

If the arguments are invalid, then an error is raised. If any of the parameters are null, null is returned. 

Example

Declare @hour as int=58

Declare @minute as int=46

Declare @seconds as int=20

Declare @fractions as int=0

Declare @precision as int=0

 

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

Output

58:46:20.0000000

Categories

More Articles

© 2013 dotNetheaven. All rights reserved.