Hi I am passing data from a database to specific textbox which is placed on my asps page, via the following code:
if (dv.Table.Rows[0][67] == null)
{
dv.Table.Rows[0][67] = "";
DateTime D7_Date = (DateTime)dv.Table.Rows[0][67];
}
else
{
DateTime D7_Date = (DateTime)dv.Table.Rows[0][67];
TextBox35.Text = "" + D7_Date;
}
However the date format includes the time for example 27/01/2010 00:00:00
I only want the textbox date field to show the date rather than the date and time.
Does anyone know where I convert the datetime field and how.
Thanks for your help in advance.
Convert date to a short date
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Vishal GilbileRank #268 · 9.4K reputationPosted Mar 12, 2013, 1:23 AM EDT
when you are setting the TextBox35 text property with D7_Date date value. just make a little change to display only date.i.e.
TextBox35.Text=D7_Date.ToShortDateString();
Hope that solves your problem.
With Regards,
Vishal Gilbile.
Alok UniyalRank #8,369 · 223 reputationPosted Mar 12, 2013, 1:36 AM EDT
You can try this:
TextBox35.Text=D7_Date.ToString("dd/MM/yyy");
Lynn Emery40 reputationPosted Mar 12, 2013, 1:45 AM EDT