hi there,

i have a datetimepicker in a form when i select a value and save it in the database it saves as 3/5/2010 12.00.00 AM why is this, the database type is DateTime and the C# code type is also DataTime. how can i save only the date value in the database????


thanxxxx

kvprajapati commented: Dont' spam board by asking trivial questions!!! -2

You've already asked a similar question before!
The DateTime class supports a date, a time or a combination of both.
When you display the value held in the DateTime object you should look at how the value is formatted to the string equivalent.
The 12.00.00 AM is displayed in your string because you are using the default general format for DateTime.

Look at the following help for String.Format
http://msdn.microsoft.com/en-us/library/fht0f5be.aspx
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

You can then ignore the fact that the DateTime has a time element.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.