TIMEFROMPARTS in SQL Server

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s