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.
Loading
Vishal GilbilePosted Mar 12, 2013, 5:23 AM
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.
Lynn EmeryPosted Mar 12, 2013, 5:45 AM
Alok UniyalPosted Mar 12, 2013, 5:36 AM
You can try this:
TextBox35.Text=D7_Date.ToString("dd/MM/yyy");