DateTime (EDM)

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

In the Entity Data Model (EDM), the DateTime type represents a date and time with values ranging from 12:00:00 midnight, January 1, 0001 A.D. through 11:59:59 P.M, December 31, 2999 A.D. The maximum precision of time is milliseconds.

This type maps to the DateTime type in SQL Server.

Facets

The DateTime type supports one EDM simple type facet. The Precision facet indicates the degree of granularity of the DateTime in fractions of a second, based on the number of decimal places supported. For example a precision of 3 means the granularity supported is milliseconds.

EDM Canonical Functions and DateTime types

EDM Promotion Rules are sufficient to determine the following CLR -> Canonical -> Store function mappings:

CLR Canonical Function Store Function SQL Server 2008 Store Function SQL Server 2005

DateTime.Year

Int Year(DateTime)

DatePart(YEAR, date)

DatePart(YEAR, date)

DateTimeOffset.Year

Int Year(DateTimeOffset)

NOT SUPPORTED

DateTime.Month

Int Month(DateTime)

DatePart(MONTH, date)

DatePart(MONTH, date)

DateTimeOffset.Year

Int Month(DateTimeOffset)

NOT SUPPORTED

DateTime.Day

Int Day(DateTime)

DatePart(DAY, date)

DatePart(DAY, date)

DateTimeOffset.Day

Int Day(DateTimeOffset)

NOT SUPPORTED

DateTime.Hour

Int Hour(DateTime)

DatePart(HOUR, date)

DatePart(HOUR, date)

DateTimeOffset.Hour

Int Hour(DateTimeOffset)

NOT SUPPORTED

Timespan.Hours

Int Hour(Time)

DateTime.Minute

Int Minute(DateTime)

DatePart(MINUTE, date)

DatePart(MINUTE, date)

DateTimeOffset.Minute

Int Minute(DateTimeOffset)

NOT SUPPORTED

Timespan.Minutes

Int Minute(Time)

DateTime.Second

Int Second(DateTime)

DatePart(SECOND, date)

DatePart(SECOND, date)

DateTimeOffset.Second

Int Second(DateTimeOffset)

NOT SUPPORTED

Timespan.Seconds

Int Second(Time)

DateTime.Millisecond

Int Millisecond(DateTime)

DatePart(MILLISECOND, date)

DatePart(MILLISECOND, date)

DateTimeOffset.Millisecond

Int Millisecond(DateTimeOffset)

NOT SUPPORTED

Timespan.Milliseconds

Int Millisecond(Time)

NOT SUPPORTED

Int GetTotalOffsetMinutes(DateTimeOffset)

DatePart(TZOFFSET,date)

NOT SUPPORTED

DateTime.Now

CurrentDateTime()1

SysDateTime()

GetDate()

DateTimeOffset.Now

CurrentDateTimeOffset()

SysDateTimeOffset()

NOT SUPPORTED

DateTime.UtcNow

CurrentUtcDateTime()

SysUtcDateTime()

GetUtcDate()

Show: