r/SQL • • Sep 25 '26

Discussion Using DateAdd for timestamps

I am making updates to some older reports and come across this line (or similar) often:

DateAdd(hh, 0, GetDate())

Why do you do that? Is there a legitimate reason why you couldn’t just write GetDate()?

7 Upvotes

19 comments sorted by

View all comments

Show parent comment

4

u/imtheorangeycenter Sep 26 '26

I've got two-decades old code that does it with convert(varchar, getdate(), 103) all over the place.

Was it me? Nooooo, not at all. Nope. Nuh-uh. What do you mean implicit conversions are bad? :D