All about DATETIME - SQLServerGeeks
All about DATETIME
Madhivanan SQL Server MVP
chnsqlug.
sql-
? Two 4-byte integers
? First 4-bytes represents number of days from the base date (January 01, 1900)
? Second 4-bytes represents time which is number of milliseconds after midnight
Internal Storage
chnsqlug.
sql-
declare @mydate datetime
set @mydate='2009-12-10 18:32:55:873'
select
@mydate as source_date,
datediff(day, '1900-01-01',@mydate) as no_of_days,
convert(char(15),@mydate,114) as time_part,
datediff(millisecond, '1900-01-01',convert(char(15),@mydate,114)) as number_of_milliseconds
Result
source_date
no_of_days time_part
milliseconds
--------------------------------------------------------------------------------------------
2009-12-10 18:32:55.873 40155 18:32:55:873 66775873
chnsqlug.
sql-
select dateadd(day,40155, '1900-01-01') as date, dateadd(millisecond,66775873,dateadd(day,40155, '1900-0101')) as source_date
date
source_date
-------------------------------------------------------------------------
2009-12-10 00:00:00.000 2009-12-10 18:32:55.873
chnsqlug.
sql-
? Datetime ? Minimum value : January 1, 1753 ? Maximum value :December 31, 9999
? Smalldatetime ? Minimum value : January 1, 1900 ? Maximum value :June 6, 2079
Date Ranges
chnsqlug.
sql-
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- all about science and technology
- all about the winter solstice
- all about me questions
- all about being a teacher
- all about me questions printable
- all about digital marketing
- all about me essays examples
- all about me preschool activities
- toddler all about me art
- all about me theme
- all about me worksheet
- all about photosynthesis