Joined: 31 Aug 2010
Online Status: Offline
Posts: 32
Topic: Date Add Field Posted: 26 Jul 2017 at 11:06am
Could someone please tell me what this command is doing?
>DateAdd("yyyy",-1,Date())
I thought I had it figured out, but I am seeing weird days in the results when executing. This is a report that I have taken over and it seems odd to me that we are using this command. Any help would be appreciated.
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 26 Jul 2017 at 11:33am
I am assuming this is part of some other code like a where clause?
it is saying
"greater than 1 year ago from this second"
So it is likely comparing a date to see if it is > 1 year ago right now.
Note that SQL GETDATE() uses current date and time so using it in a > or >= sometimes misses the "current calendar day-1 year" because the midnight portion
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum