String.Format with Dates

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • john sutor

    #1

    String.Format with Dates

    I tries using this format to return "08/19/1958", but I got back just what I
    input which was 08/19/58. Any hints
    string st4=String.Form at("{0:MM/dd/yyyy}", 08/19/58);


  • BenoitM

    #2
    Re: String.Format with Dates

    do you pass the date to format like this : 08/19/58 ?? perhaps you forgot
    the quotes : "08/19/58" ? anyway it won't work since it will be seen as
    string, you need a DateTime...
    this should work:

    string st4 = String.Format(" {0:MM/dd/yyyy}",
    Convert.ToDateT ime("08/19/58"));



    "john sutor" <john_sutor@cin fin.com> wrote in message
    news:eY194SqUDH A.1812@TK2MSFTN GP11.phx.gbl...[color=blue]
    > I tries using this format to return "08/19/1958", but I got back just what[/color]
    I[color=blue]
    > input which was 08/19/58. Any hints
    > string st4=String.Form at("{0:MM/dd/yyyy}", 08/19/58);
    >
    >[/color]


    Comment

    Working...