narasiman rao

narasiman rao

  • NA
  • 519
  • 768.3k

how to change the textbox date to ddmmyyyy format using c#

Sep 3 2014 2:05 AM
i want to validate the textboxdate and gridview row date in c#

My code as follows

DateTime selectedfromdate = Convert.ToDateTime(Txtfromdate.SelectedDateValue);
for (int i = 0; i < GvSch.Rows.Count; i++)
{
if (selectedfromdate == Convert.ToDateTime(rows.Cells[0].Text.ToString().Trim()))
{
Lblerr.Text = "selected date and excel sheet should be same";
return;
}
}

When i debug and check 
In selectedfrom date value is 9/2/2014 12:00:00 AM
rows.cells[0].text.tostring(),trim() value is 1-Sep-14

i want to change the format of selectedfrom date is 1-sep-14 format.

like same as gridview date format 1-Sep-14.

for that how can i do in asp.net using c#.

Answers (1)