Hi frnds,
i have make a form in asp.net there is an date textbox from which date and time is passing.
i only want to pass the date in database from the aspx Form not the default time.
need ur help
Thanks
Aaamir
To pass only Date from Asp.net Form
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Pravin GhadgeRank #1,340 · 1.3K reputationPosted Sep 30, 2011, 12:05 AM EDT
At time of saving date in database u have to convert the date into shortdatestring().
For eg:Convert.Datetime(txtDate.Text).ToshortDateString();
Thanks
Pravin MoreRank #1,419 · 1.2K reputationPosted Sep 30, 2011, 12:45 AM EDT
Try This..........
DateTime dtval= textBox1.Text;
dtval=dtval.Date;
This will help.
Thanx.
Prabhu RajaRank #861 · 2.6K reputationPosted Sep 30, 2011, 1:10 AM EDT
Why we are using TryParse() means, it will solve Null Reference Error. Consider, this method.
Convert.DateTime(txtBoxDate.Text.Trim()).ToShortDateString();
What Will Happen, if the textBox is Empty. It will result in error. So, I suggeset you to use TryParse() Method.
Example :
DateTime dateValue = new DateTime();
Bool isConverted = DateTime.TryParse(txtBoxDate.Text.Trim(), out dateValue);
if (isConverted)
{
//use Your Date as
dateValue.ToShortDateString();
}
else
{
// Show Message to User, for Selection of Date
}
Thank You