It may be necessary to integrate the several elements of the time into one. In such cases, SQL Server’s TIMEFROMPARTS function will come in handy.
Syntax: TIMEFROMPARTS ( hour, minute, seconds, fractions, precision )
Let’s have a look at how it works.
SELECT TIMEFROMPARTS(9,10,57,0,0)
Returns “09:10:57”
SELECT TIMEFROMPARTS (14,23,44,500,3);
Returns “14:23:44.500”
SELECT TIMEFROMPARTS ( 23, 59, 59, 0, 0 )
Returns “23:59:59”
Hope you find this article helpful.
Please subscribe for more interesting updates.
2 comments