gradinumcp
IS-IT--Management
Just a quick question:
How does DATEADD(d,-1,DATEDIFF(d,0,GETDATE())) represent yesterday's date...
My explanation which does not fit here is that datediff will do today-0 and will return 8 as today's date is 8th. Then for DateAdd don't we need a date to do the calculation...how does it do 8-1=7 which is yesterday's date?
Please give me a simple explanation for this..and maybe suggestions on other ways to get yesterday's date..
Thanks
How does DATEADD(d,-1,DATEDIFF(d,0,GETDATE())) represent yesterday's date...
My explanation which does not fit here is that datediff will do today-0 and will return 8 as today's date is 8th. Then for DateAdd don't we need a date to do the calculation...how does it do 8-1=7 which is yesterday's date?
Please give me a simple explanation for this..and maybe suggestions on other ways to get yesterday's date..
Thanks