Text Truncation

Discussion in 'ASP .Net' started by manas, Jul 1, 2005.

  1. manas

    manas Guest

    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
     
    manas, Jul 1, 2005
    #1
    1. Advertising

  2. 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

    "manas" <> wrote in message
    news:...
    > 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
    >
     
    Mark Fitzpatrick, Jul 1, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marcelo

    MySql Data Truncation

    Marcelo, Dec 19, 2005, in forum: Java
    Replies:
    3
    Views:
    17,172
    Roedy Green
    Dec 21, 2005
  2. Replies:
    3
    Views:
    1,302
    Mike Beaty
    Oct 11, 2006
  3. Magix

    truncation warning

    Magix, Aug 5, 2004, in forum: C Programming
    Replies:
    2
    Views:
    2,955
    Ravi Uday
    Aug 5, 2004
  4. Alfonso Morra

    pointer truncation from 'void *' to 'int'

    Alfonso Morra, Jul 24, 2005, in forum: C Programming
    Replies:
    26
    Views:
    1,330
    Steve Summit
    Jul 25, 2005
  5. Raga
    Replies:
    3
    Views:
    457
Loading...

Share This Page