Text Truncation

M

manas

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["Ship_Date"].ToString;
}
Thanks
polur
 
M

Mark Fitzpatrick

If 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top