Can You Determine Timezone from Request Variables?

This is more complicated but I’ve had to resort to this scenario before because machine and user profile settings sometimes don’t match your visitor’s preferences. For example, a UK visitor accessing your site temporarily from an Australian server. Use a geolocation service (e.g MaxMind.com) as suggested by @balabaster, to get the zone matching their IP … Read more

What is the Invariant Culture?

The invariant culture is a special culture which is useful because it will not change. The current culture can change from one user to another, or even from one run to another, so you can’t rely on it staying the same. Being able to use the same culture each time is very important in several … Read more

MVC 3 jQuery Validation/globalizing of number/decimal field

You could try the jQuery Globalization plugin from Microsoft: <script src=”https://stackoverflow.com/questions/5199835/@Url.Content(“~/Scripts/jquery.validate.js”)” type=”text/javascript”></script> <script src=”https://stackoverflow.com/questions/5199835/@Url.Content(“~/Scripts/jquery.validate.unobtrusive.js”)” type=”text/javascript”></script> <script src=”https://stackoverflow.com/questions/5199835/@Url.Content(“~/Scripts/jquery.glob.js”)” type=”text/javascript”></script> <script src=”https://stackoverflow.com/questions/5199835/@Url.Content(“~/Scripts/globinfo/jquery.glob.da-dk.js”)” type=”text/javascript”></script> <script type=”text/javascript”> $.validator.methods.number = function (value, element) { return !isNaN($.parseFloat(value)); } $(function () { $.preferCulture(‘da-DK’); }); </script> Plugin was renamed and moved, you should use Globalize (Mar 2012) <script src=”https://stackoverflow.com/questions/5199835/@Url.Content(“~/Scripts/jquery.globalize/globalize.js”)” type=”text/javascript”></script> <script src=”https://stackoverflow.com/questions/5199835/@Url.Content(“~/Scripts/jquery.globalize/cultures/globalize.culture.da-DK.js”)” type=”text/javascript”></script> … Read more

How to convert string to double with proper cultureinfo

You need to define a single locale that you will use for the data stored in the database, the invariant culture is there for exactly this purpose. When you display convert to the native type and then format for the user’s culture. E.g. to display: string fromDb = “123.56”; string display = double.Parse(fromDb, CultureInfo.InvariantCulture).ToString(userCulture); to … Read more

What is the difference between CurrentCulture and CurrentUICulture properties of CultureInfo in .NET?

CurrentCulture is the .NET representation of the default user locale of the system. This controls default number and date formatting and the like. CurrentUICulture refers to the default user interface language, a setting introduced in Windows 2000. This is primarily regarding the UI localization/translation part of your app. Whatever regional options the system is configured … Read more