Time (EDM)

The Time type represents an interval of time that can be added to or subtracted from an instance of the DateTime type in the Entity Data Model (EDM).

This type maps to the TimeSpan type in the common language runtime (CLR) and to the Time type in SQL Server.

EDM Canonical Functions and DateTime Types

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

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

DateTime.Year

Int Year(DateTime)

Not supported

Not supported

CLR not supported

DatePart(YEAR, date)

DatePart(YEAR, date)

Not supported

DateTimeOffset.Year

Int Year(DateTimeOffset)

Not supported

Not supported

DateTime.Month

Int Month(DateTime)

DatePart(MONTH, date)

DatePart(MONTH, date)

DateTimeOffset.Year

Int Month(DateTimeOffset)

Not supported

Not supported

DateTime.Day

Int Day(DateTime)

DatePart(DAY, date)

DatePart(DAY, date)

DateTimeOffset.Day

Int Day(DateTimeOffset)

Not supported

Not supported

DateTime.Hour

Int Hour(DateTime)

DatePart(HOUR, date)

DatePart(HOUR, date)

DateTimeOffset.Hour

Int Hour(DateTimeOffset)

Not supported

Not supported

Timespan.Hours

Int Hour(Time)

Not supported

Not supported

DateTime.Minute

Int Minute(DateTime)

DatePart(MINUTE, date)

DatePart(MINUTE, date)

DateTimeOffset.Minute

Int Minute(DateTimeOffset)

Not supported

Not supported

Timespan.Minutes

Int Minute(Time)

Not supported

Not supported

DateTime.Second

Int Second(DateTime)

DatePart(SECOND, date)

DatePart(SECOND, date)

DateTimeOffset.Second

Int Second(DateTimeOffset)

Not supported

Not supported

Timespan.Seconds

Int Second(Time)

Not supported

Not supported

DateTime.Millisecond

Int Millisecond(DateTime)

DatePart(MILLISECOND, date)

DatePart(MILLISECOND, date)

DateTimeOffset.Millisecond

Int Millisecond(DateTimeOffset)

Not supported

Not supported

Timespan.Milliseconds

Int Millisecond(Time)

Not supported

Not supported

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

See Also

Concepts

Simple Types (EDM)