Format function bug or user error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve Long

    Format function bug or user error

    Hello,
    I'm encountering a bug, or user error, with the Format function and I'm
    wondering if someone can either straighten me out or confirm the bug.
    I'm passing in a Date to the Format function and a style:

    Dim dte As Date = Date.Parse("8/19/2005 1:06:00 PM")
    Dim s As String = "mm/dd/yyyy"

    Console.WriteLi ne(Format(dte, s))

    The Format function is returning:
    06/19/2005

    What is up with this?

    Thanks in advance for any help
    Steve


  • Phil G.

    #2
    Re: Format function bug or user error

    mm = minutes, MM=month
    "Steve Long" <Steve_Noneya@N oSpam.com> wrote in message
    news:OxRsldQpFH A.3936@TK2MSFTN GP10.phx.gbl...[color=blue]
    > Hello,
    > I'm encountering a bug, or user error, with the Format function and I'm
    > wondering if someone can either straighten me out or confirm the bug.
    > I'm passing in a Date to the Format function and a style:
    >
    > Dim dte As Date = Date.Parse("8/19/2005 1:06:00 PM")
    > Dim s As String = "mm/dd/yyyy"
    >
    > Console.WriteLi ne(Format(dte, s))
    >
    > The Format function is returning:
    > 06/19/2005
    >
    > What is up with this?
    >
    > Thanks in advance for any help
    > Steve
    >
    >[/color]


    Comment

    • Armin Zingler

      #3
      Re: Format function bug or user error

      "Steve Long" <Steve_Noneya@N oSpam.com> schrieb[color=blue]
      > Hello,
      > I'm encountering a bug, or user error, with the Format function and
      > I'm wondering if someone can either straighten me out or confirm the
      > bug. I'm passing in a Date to the Format function and a style:
      >
      > Dim dte As Date = Date.Parse("8/19/2005 1:06:00 PM")
      > Dim s As String = "mm/dd/yyyy"
      >
      > Console.WriteLi ne(Format(dte, s))
      >
      > The Format function is returning:
      > 06/19/2005
      >
      > What is up with this?[/color]

      This is mm/dd/yyyy = minutes/day/year.

      Use "MM" for month.


      Armin

      Comment

      • Steve Long

        #4
        Re: Format function bug or user error

        Silly me. Thanks guys.

        Steve

        "Steve Long" <Steve_Noneya@N oSpam.com> wrote in message
        news:OxRsldQpFH A.3936@TK2MSFTN GP10.phx.gbl...[color=blue]
        > Hello,
        > I'm encountering a bug, or user error, with the Format function and I'm
        > wondering if someone can either straighten me out or confirm the bug.
        > I'm passing in a Date to the Format function and a style:
        >
        > Dim dte As Date = Date.Parse("8/19/2005 1:06:00 PM")
        > Dim s As String = "mm/dd/yyyy"
        >
        > Console.WriteLi ne(Format(dte, s))
        >
        > The Format function is returning:
        > 06/19/2005
        >
        > What is up with this?
        >
        > Thanks in advance for any help
        > Steve
        >
        >[/color]


        Comment

        • Cor Ligthert [MVP]

          #5
          Re: Format function bug or user error

          Steve,

          Will you be so kind not to write "Bug" before you are absolute sure of it.

          If everybody start from simple programs errors to tell that it can be a bug,
          than Microsoft people will for sure ignore this newsgroups to look for bugs
          what cannot be our goal.

          Thanks in advance,

          Cor


          Comment

          Working...