Convert SQL Time to get only Hour, Min & Sec

I want to convert a Column value whose type is Time to get only the time in the format HH:MM:SS. By default, for, 19:10:00, it was returning, 19:10:00 0000000. Which was obviously not required. So in the SQL query I converted the Time Field to MilitaryTime

SELECT CONVERT(VARCHAR(8), ColumnNameWhoseTypeIsTime, 108) AS MilitaryTime FROM TableName

Happy Coding …


Leave a Reply

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

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

Google photo

You are commenting using your Google 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.