Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting SQL datetime to minimum using C# DateTime

I have a datetime column in SQL Server. I believe the minimum it can be is some date in 1753 or something. My Entity Framework POCO representing the table contains a DateTime. I'd like to set the datetime in the database to the minimum it can be set to. What's the easiest way to do this?

like image 501
Sachin Kainth Avatar asked Jan 18 '13 11:01

Sachin Kainth


1 Answers

That value can be retrieved using the following property;

SqlDateTime.MinValue

See http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqldatetime.minvalue.aspx for more details.

like image 53
Chris McAtackney Avatar answered Sep 30 '22 21:09

Chris McAtackney