Minima
Minima

Reputation: 133

Format time value as HH:MM:SS

How I may be able to Trim down Time DataType when retrieving from the database?

Value from the Database : 08:00:00.0000000
What I need : 08:00:00 only

I'm SQL Server 2008, VB.Net 2010

Upvotes: 0

Views: 5650

Answers (1)

You're not really trimming (that's removing leading or trailing spaces), but any of these should work in SQL:

SELECT CAST(@YourValue as time(0))

or

SELECT LEFT(@YourValue, 8)

or

SELECT CAST(@YourValue as char(8))

Upvotes: 2

Related Questions