Ashok kumar
Ashok kumar

Reputation: 1611

About DatePart in Date functions

I couldn't understand the difference between

SELECT DATEDIFF(D,'07/09/1978',GETDATE())

SELECT DATEDIFF(DD,'07/09/1978',GETDATE())

Both are giving the same value. Then what is the difference between D, and DD?

I have the same question for

Can anybody please explain this to me?

Upvotes: 2

Views: 1424

Answers (1)

PaulStock
PaulStock

Reputation: 11263

Here is a reference on dateparts and what they mean:

As you can see, the examples you gave are all identical. However, I know some experts like Aaron Bertrand advocate not using any of the abbreviations, but spelling out the datepart.

See his excellent post on this subject here:

Upvotes: 5

Related Questions