• I removed the www from the URL, please update your bookmarks and pay attention to the bottom of the screen if using Google Chrome to allow push notifications again.

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

mmy

Member
Joined
Oct 5, 2007
Messages
24
Programming Experience
1-3
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.
 
Top Bottom