why is month format different ?

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

    #1

    why is month format different ?

    DateTime now = DateTime.Now; // { for Feb 9, 2006 }
    string test = now.ToString("m m");
    And I get 42 ?? what does this mean ?

    For
    string test = now.ToString("y yyydd");
    test = "200609" ..
    but
    string test = now.ToString("y yyymmdd");
    test = "20064209" .. I was expecting 20060209

    --
    Andrew
  • Mythran

    #2
    Re: why is month format different ?


    "andrewcw" <andrewcw@acw.c om> wrote in message
    news:57CE091E-9468-4C8D-90B7-ABB14682EE17@mi crosoft.com...[color=blue]
    > DateTime now = DateTime.Now; // { for Feb 9, 2006 }
    > string test = now.ToString("m m");
    > And I get 42 ?? what does this mean ?
    >
    > For
    > string test = now.ToString("y yyydd");
    > test = "200609" ..
    > but
    > string test = now.ToString("y yyymmdd");
    > test = "20064209" .. I was expecting 20060209
    >
    > --
    > Andrew[/color]

    You are getting the MINUTES portion of the date/time.

    ToString expects mm for Minutes and MM for Month :)

    Mythran

    Comment

    • andrewcw

      #3
      Re: why is month format different ?

      Thanks ! :)
      --
      Andrew


      "Mythran" wrote:
      [color=blue]
      >
      > "andrewcw" <andrewcw@acw.c om> wrote in message
      > news:57CE091E-9468-4C8D-90B7-ABB14682EE17@mi crosoft.com...[color=green]
      > > DateTime now = DateTime.Now; // { for Feb 9, 2006 }
      > > string test = now.ToString("m m");
      > > And I get 42 ?? what does this mean ?
      > >
      > > For
      > > string test = now.ToString("y yyydd");
      > > test = "200609" ..
      > > but
      > > string test = now.ToString("y yyymmdd");
      > > test = "20064209" .. I was expecting 20060209
      > >
      > > --
      > > Andrew[/color]
      >
      > You are getting the MINUTES portion of the date/time.
      >
      > ToString expects mm for Minutes and MM for Month :)
      >
      > Mythran
      >
      >[/color]

      Comment

      Working...