Udostępnij za pośrednictwem


System.DateTimeOffset Methods (LINQ to SQL)

Once mapped in the object model or external mapping file, LINQ to SQL allows you to call most of the System.DateTimeOffset methods, operators, and properties from within your LINQ to SQL queries.

The only methods not supported are those inherited from System.Object that do not make sense in the context of LINQ to SQL queries, such as: Finalize, GetHashCode, GetType, and MemberwiseClone. These methods are not supported because LINQ to SQL cannot translate them for execution on the SQL Server.

Note

The common language runtime (CLR) System.DateTimeOffset structure, and the ability to map it to a SQL DATETIMEOFFSET column with LINQ to SQL, requires the .NET Framework 3.5 SP1 or beyond. The SQL DATETIMEOFFSET column is only available in Microsoft SQL Server 2008 and beyond.

SQLMethods Date and Time Methods

In addition to the methods offered by the DateTimeOffset structure, LINQ to SQL offers the methods listed in the following table from the System.Data.Linq.SqlClient.SqlMethods class for working with date and time.

DateDiffDay

DateDiffMillisecond

DateDiffNanosecond

DateDiffHour

DateDiffMinute

DateDiffSecond

DateDiffMicrosecond

DateDiffMonth

DateDiffYear

See Also

Reference

SQL-CLR Type Mapping (LINQ to SQL)

Other Resources

Query Concepts in LINQ to SQL

Creating the Object Model (LINQ to SQL)