regional-settings

Reading the regional location setting (country code) in Windows using Ruby?

馋奶兔 提交于 2019-12-02 07:37:33
问题 I am trying to access the Control Panel: Region and Language: Location: Current location setting using Ruby. I am only interested in the country code. The closest I have got is the country code from the System Locale but that is not quite what I was after. `systeminfo | findstr /B /C:"System Locale"`.to_s.upcase.strip[30..31] I hope that someone out there might know. Thanks. 回答1: Using the Win32 API: require 'Win32API' # Set up some Win32 constants GEOCLASS_NATION = 16 GEO_ISO2 = 4 GEO

Convert.ToString(DateTime) yielding UK format instead of US

假如想象 提交于 2019-12-02 07:04:37
问题 I'm having an issue where a C# DateTime string is failing to convert to a SQL DateTime because it is mysteriously being formatted as a UK date (dd/MM/yyyy). Here is the series of events: An object is created on a remote server in the US and serialized to xml. The xml is deserialized on a local computer in CA back to an object. The serialized date looks like this: 2011-07-13T09:56:57.0542425 The application attempts to save the object to the database calling the previously mentioned stored

Reading the regional location setting (country code) in Windows using Ruby?

﹥>﹥吖頭↗ 提交于 2019-12-02 04:21:01
I am trying to access the Control Panel: Region and Language: Location: Current location setting using Ruby. I am only interested in the country code. The closest I have got is the country code from the System Locale but that is not quite what I was after. `systeminfo | findstr /B /C:"System Locale"`.to_s.upcase.strip[30..31] I hope that someone out there might know. Thanks. Using the Win32 API: require 'Win32API' # Set up some Win32 constants GEOCLASS_NATION = 16 GEO_ISO2 = 4 GEO_FRIENDLYNAME = 8 # Set up some API calls GetUserGeoID = Win32API.new('kernel32', 'GetUserGeoID', ['L'], 'L')

Convert.ToString(DateTime) yielding UK format instead of US

我的梦境 提交于 2019-12-02 02:07:33
I'm having an issue where a C# DateTime string is failing to convert to a SQL DateTime because it is mysteriously being formatted as a UK date (dd/MM/yyyy). Here is the series of events: An object is created on a remote server in the US and serialized to xml. The xml is deserialized on a local computer in CA back to an object. The serialized date looks like this: 2011-07-13T09:56:57.0542425 The application attempts to save the object to the database calling the previously mentioned stored procedure. It (needlessly) converts the date to a string before passing it as a parameter to the sproc

Can I set the decimal symbol to use everywhere in my application

走远了吗. 提交于 2019-12-02 01:39:25
I tracked down a bug in my application that occurred for people in countries where the default decimal symbol was a comma instead of a period. Is there any way in C# to set the decimal symbol for my application without affecting other apps or permanently changing the system settings? I tried this but it says the NumberDecimalSeparator is readonly. Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator = "."; I you still need to do that you can change the CurrentCulture on the thread like so: Thread.CurrentThread.CurrentCulture = new CultureInfo("en-Us"); Chooe a Culture that

Change the system Region/Location setting using vbs

筅森魡賤 提交于 2019-12-02 01:01:55
问题 I was wondering if perhaps somebody could assist with a query I have. Once a week i get file from my US counterpart that i need to save locally to my machine, and change the format of the file. I have since created a VBScript that can perform a SaveAs routine and save it, however in order to retain the date formats in US, I am having to change my Region setting to US in control panel before the procedure and after to change to default local setting. I have been researching this and got some

Change the system Region/Location setting using vbs

随声附和 提交于 2019-12-01 21:56:24
I was wondering if perhaps somebody could assist with a query I have. Once a week i get file from my US counterpart that i need to save locally to my machine, and change the format of the file. I have since created a VBScript that can perform a SaveAs routine and save it, however in order to retain the date formats in US, I am having to change my Region setting to US in control panel before the procedure and after to change to default local setting. I have been researching this and got some ideas from the Microsoft site that shows how to use the Set Locale and Get locale, but my code doesnt

How to get/set current location in windows?

别来无恙 提交于 2019-12-01 19:31:30
I need to be able to get/set current location in Win 7 (Control Panel -> Regional and Language -> Location): RegionInfo.CurrentRegion doesn't work (can I use it in wrng way??) The same with CultureInfo . Any ideas? Ok you need to change windows register HKEY_CURRENT_USER\Control Panel\International\Geo and there you need change 'Nation' The data is stored in the registry. You need to overwrite these keys. To know where it's stored in the registry reead this article: http://www.windowsitpro.com/article/registry2/jsi-tip-0311-regional-settings-in-the-registry- You can use this code CultureInfo

ASP.NET application doesn't reflect Regional settings

邮差的信 提交于 2019-11-30 09:29:18
问题 I've set, in my regional settings (for Czech, culture cs-CZ), the short time / long time pattern to following: Short time: H.mm Long time: H.mm.ss I'm trying to use those settings in C# applications. In following console app, everything works: using System; using System.Globalization; class Program { static void Main() { Console.WriteLine(CultureInfo.CurrentCulture.Name); Console.WriteLine(CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern); Console.ReadLine(); } } The output is, as I

ASP.NET application doesn't reflect Regional settings

↘锁芯ラ 提交于 2019-11-29 15:28:22
I've set, in my regional settings (for Czech, culture cs-CZ), the short time / long time pattern to following: Short time: H.mm Long time: H.mm.ss I'm trying to use those settings in C# applications. In following console app, everything works: using System; using System.Globalization; class Program { static void Main() { Console.WriteLine(CultureInfo.CurrentCulture.Name); Console.WriteLine(CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern); Console.ReadLine(); } } The output is, as I thought, following: cs-CZ H.mm.ss I've created ASP.NET application, which, to my uttermost surprise,