Date problem?

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

    #1

    Date problem?

    Why on some computers DateTime.Today. ToShortDateStri ng()
    returns date in "9999-99-99" format and on other machines
    I get "99-99-99"? How to make it independent?


  • Martín Marconcini

    #2
    Re: Date problem?

    On Wed, 1 Oct 2003 12:21:58 +0200, Jacek Jurkowski <jjurkowski@op. pl>
    wrote:
    [color=blue]
    > Why on some computers DateTime.Today. ToShortDateStri ng()
    > returns date in "9999-99-99" format and on other machines
    > I get "99-99-99"? How to make it independent?[/color]

    Does it has to do with the Local Settings in control panel? You can
    specify the date/time/number format under regional settings.


    Regards,

    --
    Martín Marconcini

    Comment

    • Nicholas Paldino [.NET/C# MVP]

      #3
      Re: Date problem?

      Jacek,

      If you want to make it independent then you can specify the format
      string in the call to ToString. In your case, I assume you want a
      four-digit year, so you would use a format of:

      yyyy-MM-dd

      Hope this helps.


      --
      - Nicholas Paldino [.NET/C# MVP]
      - nick(dot)paldin o=at=exisconsul ting<dot>com

      "Jacek Jurkowski" <jjurkowski@op. pl> wrote in message
      news:uEwSwXAiDH A.1368@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Why on some computers DateTime.Today. ToShortDateStri ng()
      > returns date in "9999-99-99" format and on other machines
      > I get "99-99-99"? How to make it independent?
      >
      >[/color]


      Comment

      • Ignacio Machin

        #4
        Re: Date problem?

        Hi Jacek,

        It depends of the Regional Options as defined in the control panel. If you
        want to make it independed you need to use ToString(IForma tProvider).

        Hope this help,

        --
        Ignacio Machin,
        ignacio.machin AT dot.state.fl.us
        Florida Department Of Transportation




        "Jacek Jurkowski" <jjurkowski@op. pl> wrote in message
        news:uEwSwXAiDH A.1368@TK2MSFTN GP12.phx.gbl...[color=blue]
        > Why on some computers DateTime.Today. ToShortDateStri ng()
        > returns date in "9999-99-99" format and on other machines
        > I get "99-99-99"? How to make it independent?
        >
        >[/color]


        Comment

        Working...