I have seen posts in the question on how to remove milliseconds from the datetime datatype in MS SQL.
But what about the time datatype - what is the easiest way to remove milliseconds from the time datatype?
Also: Is there any time datatype in MS SQL (2008) that doesn't include milliseconds?
Thanks all!
Use the setSeconds() method to remove the seconds and milliseconds from a date, e.g. date. setSeconds(0, 0) . The setSeconds method takes the seconds and milliseconds as parameters and sets the provided values on the date. Copied!
One of the easiest way to remove milliseconds is:
SELECT CONVERT(VARCHAR, GETDATE(), 20)
And if you dont want to include milliseconds:
TIME(0) will help
Example
CAST(DATEADD(second, SUM(hora), '00:00:00') AS time(0))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With