0

what's the best way to change seconds and set them 00 on my column like

2020-07-01 14:15:23.000

2020-07-01 14:15:00.000

I want to round datetime 2020-07-01 14:15:23.000 to 2020-07-01 14:15:00.000

thank you in Advance, I am new to SQL.

BenUK
  • 15
  • 2
  • 3
    Does the answer at https://stackoverflow.com/questions/24496489/truncate-seconds-and-milliseconds-in-sql help you? – EdmCoff Aug 19 '22 at 19:51
  • The answer suggested by @EdmCoff should work. If it needs to be converted back to the same format again then: select CAST(cast('2020-07-01 14:15:32.888' as smalldatetime) AS datetime) – Viraj A Aug 19 '22 at 20:31
  • @EdmCoff that worked like a treat cheers – BenUK Aug 19 '22 at 20:59

0 Answers0