I have a dataview which is returning the shipdate information like
01/23/2005 10:23:23 from the database , i need to truncate the time
part of the ship date information ,
currently i am using..
I am creating a separate column at runtime and and assigning the ship
date information to that new column ,
Always String has a remove function which truncates the characters, but
how do i do that for a ROW..
If you guys have a better solutions , i ll appreciate your help
Attached is my code:
DataColumn myCol3 = dvResults.Table.Columns.Add("ShipDate1");
DataRow ship;
dvResults.Table.Columns.Add(myCol3);
for(int i=0;i<dvResults.Table.Rows.Count;i++)
{
dvResults.Table["ship"] =
dvResults.Table.Rows[i]["Ship_Date"].ToString;
}
Thanks
polurIf it's already a datetime format, you could cast or convert it to a
System.DateTime. Then just use the ToShortDateString() method which will
only return the date, not the time part.
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
"manas" <mahesh.manas@.gmail.com> wrote in message
news:1120256123.749385.86050@.g43g2000cwa.googlegro ups.com...
> hi,
> I have a dataview which is returning the shipdate information like
> 01/23/2005 10:23:23 from the database , i need to truncate the time
> part of the ship date information ,
> currently i am using..
> I am creating a separate column at runtime and and assigning the ship
> date information to that new column ,
> Always String has a remove function which truncates the characters, but
> how do i do that for a ROW..
> If you guys have a better solutions , i ll appreciate your help
> Attached is my code:
> DataColumn myCol3 = dvResults.Table.Columns.Add("ShipDate1");
> DataRow ship;
> dvResults.Table.Columns.Add(myCol3);
> for(int i=0;i<dvResults.Table.Rows.Count;i++)
> {
> dvResults.Table["ship"] =
> dvResults.Table.Rows[i]["Ship_Date"].ToString;
> }
> Thanks
> polur
0 comments:
Post a Comment