What are the most suitable equivalent C# data types for the date datatypes in SQL Server? I'm specifically looking for
datetimedatetimeoffset
What are the most suitable equivalent C# data types for the date datatypes in SQL Server? I'm specifically looking for
datetime datetimeoffsetHere are the equivalent CLR data types for date, time and datetimeoffset SQL Server data types:
date - DateTime, Nullable<DateTime>
time - TimeSpan, Nullable<TimeSpan>
datetimeoffset - DateTimeOffset, Nullable<DateTimeOffset>
Note that you can find a listing of all SQL Server data types and their CLR equivalents here, Mapping CLR Parameter Data
The new types are supported only if you install .NET Framework 3.5 SP1.
SqlDbType.Date
SqlDbType.Time
SqlDbType.DateTime2
SqlDbType.DateTimeOffSet
For exhaustive information, see Date and Time Data in SQL Server 2008