quinnipiac0807
Programmer
I'm just trying to convert a column in a datagrid to dd-mm-yyyy instead of day/month/year and then time.
This is my statement:
try
{
DateTime StartTime = Convert.ToDateTime(drv.Row.ItemArray[1]);
e.Item.Cells[1].Text = StartTime.ToShortDateString();
}
catch
{
e.Item.Cells[1].Text = "";
}
For some reason it skips over the try after it executes the first line (DateTime StartTime ....) and goes right to the catch, printing nothing. There is data there that should be converted. StartTime is in Column 1 so that's not the problem but I don't understand why it skips to the catch.
This is my statement:
try
{
DateTime StartTime = Convert.ToDateTime(drv.Row.ItemArray[1]);
e.Item.Cells[1].Text = StartTime.ToShortDateString();
}
catch
{
e.Item.Cells[1].Text = "";
}
For some reason it skips over the try after it executes the first line (DateTime StartTime ....) and goes right to the catch, printing nothing. There is data there that should be converted. StartTime is in Column 1 so that's not the problem but I don't understand why it skips to the catch.