I found below statement regarding "date" column type:
"date" s开发者_运维问答tores only the date component without the time component, ranging from 1st January 0001 to 31st December 9999, with accuracy of 1 day
I am not able to understand what is meaning of accuracy here?
I found this statement on: http://www.sqlservercentral.com/articles/News/3253/
day because it's "date"
Read The ultimate guide to the datetime datatypes by Tibor Karaszi
It means that the minimum difference from date
to date
is a single day, nothing less.
In other words, you can't store hours in a date
column.
Or, that the data is accurate to within a day.
See date
on MSDN:
- Range - 0001-01-01 through 9999-12-31. January 1, 1 A.D. through December 31, 9999 A.D.
- Accuracy - One day
The date
type stores the value internally as an integer, meaning the number of days since 0001-01-01. The value 0001-01-03
for example would be stored internally as 2
.
The term "accuracy" is probably used here because it's used to express the resolution of other date/time types. The resolution for the date
type is simply one day, just as you would expect. The accuracy (resolution) for the datetime
type for example is 3.33 milliseconds.
I agree the use of "accuracy" is poor wording.
Personally, I would employ the phrase, "its smallest time granule is one day."
Accuracy?
It does what it says. It stores a date, not time...
From date (Transact-SQL)
Element ranges
YYYY is four digits from 0001 to 9999 that represent a year.
MM is two digits from 01 to 12 that represent a month in the specified year.
DD is two digits from 01 to 31, depending on the month, that represent a day of the specified month.
where as
from datetime (Transact-SQL)
Element ranges
YYYY is four digits from 1753 through 9999 that represent a year.
MM is two digits, ranging from 01 to 12, that represent a month in the specified year.
DD is two digits, ranging from 01 to 31 depending on the month, that represent a day of the specified month.
hh is two digits, ranging from 00 to 23, that represent the hour.
mm is two digits, ranging from 00 to 59, that represent the minute.
ss is two digits, ranging from 00 to 59, that represent the second.
n* is zero to three digits, ranging from 0 to 999, that represent the fractional seconds.
精彩评论