regional-settings

Using dateFormatter in another language [duplicate]

最后都变了- 提交于 2019-12-11 06:54:31
问题 This question already has answers here : NSDateFormatter returns nil in swift and iOS SDK 8.0 (2 answers) Closed 2 years ago . I'm running a piece of code that returns nil when running on an iPhone with a different language setting. An example in code looks like this: let dateFormatter = DateFormatter() dateFormatter.dateFormat = "MMM d, yyyy, h:mm a" let thisDate = "Mar 4, 2017, 7:50 PM" let foundationDate = dateFormatter.string(from: Foundation.Date()) print("As String - thisDate: \

Make TryParse compatible with comma or dot decimal separator

帅比萌擦擦* 提交于 2019-12-10 22:03:18
问题 The problem: Let's assume you are using a dot "." as a decimal separator in your regional setting and have coded a string with a comma. string str = "2,5"; What happens when you decimal.TryParse(str, out somevariable); it? somevariable will assume 0. What can you do to solve it? 1- You can decimal.TryParse(str, NumberStyles.Any, CultureInfo.InvariantCulture, out somevariable); And it will return 25, and not 2.5 which is wrong. 2- You can decimal.TryParse(str.Replace(",","."), out num); And it

Hot to get user’s regional settings for currency in JavaScript or jQuery?

萝らか妹 提交于 2019-12-10 13:54:40
问题 I’m trying to format some numbers with jQuery. I would like to get the user’s regional settings for currency and number, in order to implement the correct format (obtain the decimal separator). Is it possible to retrieve these parameters with jQuery or JavaScript? 回答1: Use toLocaleString() with style:'currency' : var amount = 123.56; alert( 'German: ' + amount.toLocaleString('de-DE',{style:'currency',currency:'EUR'}) + ', ' + 'American: ' + amount.toLocaleString('en-US',{style:'currency'

VBA converts string “12.00” to 1200 instead of 12.00. This happens only on EU regional setting and not US settings

ε祈祈猫儿з 提交于 2019-12-07 18:43:44
问题 I don't know why but the string in vba is "12.00" and when I conver to a double with myDouble= CDbl(stringDouble) or myDouble = stringDouble I cannot do anything.. any help? (I cannot change the regional settings to US on all pcs..) thanks 回答1: As you already noted in your comments, this is a regional setting - as your system is using , as the decimal separator, the string gets converted to 1200 . The solution in this case is to convert it with Val : Sub Sample() Dim myDouble As Double Dim

Oracle ODBC: Why are national characters changed to Latin equivalent in SELECT result

ぃ、小莉子 提交于 2019-12-06 07:19:30
问题 I have Oracle 11 database to which I connect using both JDBC and ODBC. JDBC works well, but in ODBC all Polish letters in SELECT result are changed to Latin equivalent, for example ą -> a , Ó -> O etc. I tested it with my application and simple Python program that uses odbc module. The same value from database is returned as: ZAMOŚĆ - by JDBC ZAMOSC - by ODBC My environment: DB server: Oracle Database 11g Release 11.2.0.1.0 - 64bit Production Client machine: Windows Server 2008 R2 64 bit

VBA converts string “12.00” to 1200 instead of 12.00. This happens only on EU regional setting and not US settings

99封情书 提交于 2019-12-06 05:13:51
I don't know why but the string in vba is "12.00" and when I conver to a double with myDouble= CDbl(stringDouble) or myDouble = stringDouble I cannot do anything.. any help? (I cannot change the regional settings to US on all pcs..) thanks As you already noted in your comments, this is a regional setting - as your system is using , as the decimal separator, the string gets converted to 1200 . The solution in this case is to convert it with Val : Sub Sample() Dim myDouble As Double Dim stringDouble As String stringDouble = "12.00" myDouble = Val(stringDouble) End Sub This is most likely due to

Cross-regional decimal/double parsing

ぃ、小莉子 提交于 2019-12-05 11:30:18
As a matter of fact, I have multiple systems that can generate numeric data and they are stored on some web server in text files. Some of the systems use decimal point as fraction separator, some of the systems use decimal comma as same. Applications (fat client, .net 2.0) can also be run on either kind of systems. So after some stumbling I did this: ( http://pastebin.com/vhLXABDD ) public static bool HasDecimalComma; public static bool HasDecimalPeriod; public static double GetNumber(string NumberString) { if (!HasDecimalComma && !HasDecimalPeriod) { string s = string.Format("{0:0.0}", 123

Oracle ODBC: Why are national characters changed to Latin equivalent in SELECT result

笑着哭i 提交于 2019-12-04 13:57:36
I have Oracle 11 database to which I connect using both JDBC and ODBC. JDBC works well, but in ODBC all Polish letters in SELECT result are changed to Latin equivalent, for example ą -> a , Ó -> O etc. I tested it with my application and simple Python program that uses odbc module. The same value from database is returned as: ZAMOŚĆ - by JDBC ZAMOSC - by ODBC My environment: DB server: Oracle Database 11g Release 11.2.0.1.0 - 64bit Production Client machine: Windows Server 2008 R2 64 bit Oracle clients in 32 bit and 64 bit versions in: c:\Oracle\Ora1120_32bit and c:\Oracle\Ora1120_64bit ODBC

How to get/set current location in windows?

末鹿安然 提交于 2019-12-04 03:45:14
问题 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? 回答1: Ok you need to change windows register HKEY_CURRENT_USER\Control Panel\International\Geo and there you need change 'Nation' 回答2: 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

How to detect visitor country

橙三吉。 提交于 2019-12-02 20:13:41
问题 To detect a visitor country I see this below code suggested in many forums, but I cant get it working. modGlobal.ResolveCountry.ThreeLetterISORegionName On my local machine it correctly return my computer retional settings region whereas it on the production server always return USA. I guess this is because the function return the envoirement regional settings (ie the servers regional setting), can anyone confirm this? And if true, what is best practice for detecting visitors country in asp