0

I am trying to find a way to get CultureInfo of that is used by the operating system - Windows - for the clock.

enter image description here

enter image description here

My system is en-US, but my calendar uses de-DE formats, but when I check the following properties, all of them show me en-US

CultureInfo.CurrentCulture
CultureInfo.CurrentUICulture
CurrentInfo.InstalledUICulture

Is there any way to get the CultureInfo used by the operating system - Windows - clock?

shA.t
  • 16,580
  • 5
  • 54
  • 111
blfuentes
  • 2,731
  • 5
  • 44
  • 72
  • What exactly do you mean by "for the calendar"? Where exactly have you set this on your system? – Jon Skeet Feb 11 '15 at 08:20
  • Maybe your calender has an option of culture itself and overrides these values? – Soner Gönül Feb 11 '15 at 08:20
  • The system clock is using German format, but my system is installed in English. I am trying to find a way how to get the cultureinfo used by the system clock. – blfuentes Feb 11 '15 at 08:23
  • @SonerGönül It is not a problem that the system clock is in German. I am working on an excel addIn and I need to show in some WPF forms datetime values formatted with the system clock culture, instead of the current thread, installed... – blfuentes Feb 11 '15 at 08:26
  • UI Language of your Windows? – DrKoch Feb 11 '15 at 08:28
  • @DrKoch As I mentioned, UI of my windows is in `en-US`. Only the system clock is using the `de-DE` . All the CultureInfo.* properties I tried show `en-US`. – blfuentes Feb 11 '15 at 08:30
  • Could you override culture of calender ? With this option you can control the calender format, maybe you can take culture info from other components. – Ahmet Arslan Feb 11 '15 at 08:42
  • @AhmetArslan I don't want/need to override any format. I just need to know what is the cultureinfo used by the system clock. – blfuentes Feb 11 '15 at 08:44
  • Why does your clock use the `de-DE` format? Which setting did you change? Language, and Region-> Regional and Language -> Format? – sloth Feb 11 '15 at 08:51
  • @sloth Yes, I changed the format in the region and language settings. – blfuentes Feb 11 '15 at 09:43
  • When you set the format to __German (Germany)__ in the dialog box in your screen shot you should see that `CultureInfo.CurrentCulture` reflects this setting. In addition, if you perform further customizations of the format as you can do in the dialog box these changes will be reflected in `CultureInfo.CurrentCulture`. However, the format setting is a user setting so if your process run as another user then you will get `CultureInfo.CurrentCulture` for that user - not your own setting. That might explain the discrepancy you experience. – Martin Liversage Feb 11 '15 at 10:19
  • To add to my previous comment: I believe your mistake is referring to the __system__ calendar. There is no system calendar. Instead each user is able to select a personal culture for date and time formatting. However, the initial culture used for new user accounts can be modified in the __Administrative__ tab on the dialog box of your screen shot. – Martin Liversage Feb 11 '15 at 11:35
  • @MartinLiversage Thanks for the explanation. And could it be possible to access to these personal settings? – blfuentes Feb 11 '15 at 11:38
  • 1
    @blacai: Sure you can if you are determined enough. The setting is stored somewhere on the computer. But if my hypothesis is true and your application run as another user (perhaps as a service?) do you want to create code that inside this service accesses your user profile to get your personal setting? What if the application runs on another computer where you do not have a user profile? Perhaps you should rethink your problem to figure out what it really is you want to achieve? – Martin Liversage Feb 11 '15 at 11:52

0 Answers0