Using string format

Discussion in 'ASP .Net' started by William F. Robertson, Jr., Jul 17, 2003.

  1. I have a question about the string formatting function.

    I have a field in a database that is coming back as a 6 digit date:

    061503

    I would like to format this out to 06/15/03 to be displayed on a page.

    What StringFormat parameter do I apply to the Column to get this desired
    result? Or should I be converting in in the SqlQuery? If the query option
    is the correct one, how do I do that in the query.

    Currently the field is a nvarchar that gets converted to varchar

    SELECT Convert( varchar, Cycle, 1 ) as CycleDate FROM ...

    Thanks,

    bill
    William F. Robertson, Jr., Jul 17, 2003
    #1
    1. Advertising

  2. Hello Bill,

    Try to look at this link ...

    http://www.vbcentral.net/quickstart/howto/doc/format.aspx


    Hope this helps...
    -James A Taber


    "William F. Robertson, Jr." <> wrote in message
    news:...
    > I have a question about the string formatting function.
    >
    > I have a field in a database that is coming back as a 6 digit date:
    >
    > 061503
    >
    > I would like to format this out to 06/15/03 to be displayed on a page.
    >
    > What StringFormat parameter do I apply to the Column to get this desired
    > result? Or should I be converting in in the SqlQuery? If the query

    option
    > is the correct one, how do I do that in the query.
    >
    > Currently the field is a nvarchar that gets converted to varchar
    >
    > SELECT Convert( varchar, Cycle, 1 ) as CycleDate FROM ...
    >
    > Thanks,
    >
    > bill
    >
    >
    James A Taber, Jul 17, 2003
    #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. Brian Candy
    Replies:
    2
    Views:
    1,155
    Janaka
    Feb 18, 2004
  2. ankur
    Replies:
    1
    Views:
    12,737
    Jan =?UTF-8?B?VGhvbcOk?=
    Aug 27, 2007
  3. Chris Angelico
    Replies:
    3
    Views:
    150
    Mark Lawrence
    Mar 1, 2013
  4. Peter Otten
    Replies:
    0
    Views:
    130
    Peter Otten
    Feb 28, 2013
  5. Rick Johnson
    Replies:
    0
    Views:
    137
    Rick Johnson
    Feb 28, 2013
Loading...

Share This Page