Results 1 to 2 of 2

Thread: ShortDatePattern always returns d/MM/yyyy instead off ...

  1. #1
    mmy
    mmy is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.0 (VS 2005/2008)
    Join Date
    Oct 2007
    Posts
    24
    Reputation
    118

    ShortDatePattern always returns d/MM/yyyy instead off ...

    Hi,

    I have tried the code below in a windows form and a windows service.
    Code:
    System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern
    It returns the short date format configured in the operating system, for example: M/d/yyyy

    However, when I use exactly the same code in another project (a windows service) it always returns d/MM/yyyy (I placed the code in the onstart sub)
    I know this code shows the short date format in the current thread, so I know I have to restart the service if I change the dateformat of the operating system during runtime.

    When creating a completely new "empty" service, with just this code, everything works ok again. With the other code, the problem returns (it always shows d/MM/yyyy).
    I have checked my code, there are no places where I set or change the culture, ...

    Anybody knows if there's another parameter or property I should check in the project? I know this problem is vague, but the complete code is pretty long, so can't post it.

  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.5
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    15,086
    Reputation
    2803

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •