ASP.NET - how to insert only date in database in "dd/MM/yyyy" format using c# asp.net
Asked By bhanupratap singh on 02-Aug-12 10:09 AM
I have sql server 2008. I want to insert only date into table in "dd/MM/yyyy" format, not time. i m getting date value from
user txtDate.Text. How to do it
Peter Bromberg replied to bhanupratap singh on 02-Aug-12 03:44 PM
If the column is of type datetime in the database, then it is always going to have a time component even if you do not provide it. Just use
DateTime myDate = DateTime.Parse(txtDate.Text);
and insert the value as a DateTime object.