共用方式為


DateTime (EDM)

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 DataTime type in SQL Server.

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 KATMAI Store Function YUKON

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()