Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i made an windows application. in that i am using some convert.toint,convert.todouble,convert.tostring() and some timespan and datetime. it is working with english language but not supporting in german. is there any api or function by using that i can check whether it is english or german and put condition according to os. and how to convert all these conversion from english to german.

Thanks
Posted

As far as i know german format of date is: dd.mm.yy and english is: mm/dd/yyyy. To convert it to a proper date, you need to set/change localization[^].

For further information, please see:
Globalizing and Localizing .NET Framework Applications[^]
Comparing and Sorting Data for a Specific Culture[^]
How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization[^]

[EDIT]
I found very interesrting site: Globalization Step-by-Step[^]. There you'll find information about date formatting and converting ;)
[/EDIT]
 
Share this answer
 
v2
Use the Parse functions of the corresponding datatypes, e.g. double.Parse or double.TryParse instead of Convert.
 
Share this answer
 
Comments
Maciej Los 3-Mar-14 2:33am    
Bernard, sorry, but it is wrong answer. Please, see my answer.
BTW: i did not vote.
Vedat Ozan Oner 3-Mar-14 2:47am    
Maciej is right.
Bernhard Hiller 3-Mar-14 5:46am    
Are you sure? Since he talked about Convert-functions, my impression is that he was stuck with reading values from the UI, not with formatting values to be shown on the UI. double.Parse uses the comma as decimal separator for German, and the dot for US-English.
Maciej Los 3-Mar-14 5:50am    
I'm not sure for 100%, but almost ;)
My answer is corresponding to these words: whether it is english or german and put condition according to os. and how to convert all these conversion from english to german.
If you set German culture for application, you'll be able to enter decimal values according to German OS, even if your OS is English.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900