-2

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

Votes + Comments
Dont' spam board by asking trivial questions!!!
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by nick.crane
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.