cultureinfo

C# Connecting to Oracle DB DateTime formatting

百般思念 提交于 2019-12-02 01:59:22
问题 I have a .Net webapp that is connecting to an Oracle backend. I have a base page which every page uses where I set my protected override void OnPreInit(EventArgs e) { System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-CA"); // Creating the DateTime Information specific to our application. System.Globalization.DateTimeFormatInfo dateTimeInfo = new System.Globalization.DateTimeFormatInfo(); // Defining various date and time formats. dateTimeInfo

String was not recognized as a valid DateTime?

99封情书 提交于 2019-12-02 01:28:26
问题 I try to convert string to datetime but each time I get : String was not recognized as a valid DateTime. Code is: string format = "dd/MM/yyyy"; obj.TransDate = DateTime.ParseExact(lbl_TransDate.Text.Split('/')[0] + "/" + lbl_TransDate.Text.Split('/')[1] + "/" + lbl_TransDate.Text.Split('/')[2], format, CultureInfo.InvariantCulture); When I debug the date which I try to parse it is : 12/4/2012 回答1: The desired format is string format = "dd/M/yyyy"; I don't understand a thing though, why split

C# Connecting to Oracle DB DateTime formatting

核能气质少年 提交于 2019-12-02 00:26:39
I have a .Net webapp that is connecting to an Oracle backend. I have a base page which every page uses where I set my protected override void OnPreInit(EventArgs e) { System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-CA"); // Creating the DateTime Information specific to our application. System.Globalization.DateTimeFormatInfo dateTimeInfo = new System.Globalization.DateTimeFormatInfo(); // Defining various date and time formats. dateTimeInfo.DateSeparator = "/"; dateTimeInfo.LongDatePattern = "dd-MMM-yyyy"; dateTimeInfo.ShortDatePattern = "dd-MMM-yyyy";

How can I override the currency formatting for the current culture for an ASP.NET web application?

半城伤御伤魂 提交于 2019-12-01 22:26:21
The currency decimal and thousand separators for the en-ZA region are ',' and ' ' respectively, but the separators in common use are '.' for decimal, plus my user wants ',' for the thousands separator. I wish to set these globally, so that I only have to use the {0:C} format string for all my currency fields, without having to any explicit Format or ToString calls. I would prefer to be able to do this without changing the culture settings on the web server, as I also need to set the decimal places for currency to zero, as cents are not wanted when reporting on estimates of R100k and up etc. I

How can I override the currency formatting for the current culture for an ASP.NET web application?

六眼飞鱼酱① 提交于 2019-12-01 21:57:53
问题 The currency decimal and thousand separators for the en-ZA region are ',' and ' ' respectively, but the separators in common use are '.' for decimal, plus my user wants ',' for the thousands separator. I wish to set these globally, so that I only have to use the {0:C} format string for all my currency fields, without having to any explicit Format or ToString calls. I would prefer to be able to do this without changing the culture settings on the web server, as I also need to set the decimal

Different DateTimeFormat for the same culture in different machines

佐手、 提交于 2019-12-01 21:42:04
问题 I'm having a problem when I deploy my web application in different servers. There seems to be an inconsistency in some DateTimeFormat patterns, like ShortDatePattern , using the same culture (pt-BR). In my development machine (Windows 7, .NET 4 installed, application targeting .NET 3.5) and a Windows Server 2008 R2 (with the application targeting .NET 4) server the ShortDatePattern is "dd/MM/yyyy" - which is the correct, I guess. In the production server (Windows Server 2003, using .NET 3.5)

Different DateTimeFormat for the same culture in different machines

我与影子孤独终老i 提交于 2019-12-01 20:56:30
I'm having a problem when I deploy my web application in different servers. There seems to be an inconsistency in some DateTimeFormat patterns, like ShortDatePattern , using the same culture (pt-BR). In my development machine (Windows 7, .NET 4 installed, application targeting .NET 3.5) and a Windows Server 2008 R2 (with the application targeting .NET 4) server the ShortDatePattern is "dd/MM/yyyy" - which is the correct, I guess. In the production server (Windows Server 2003, using .NET 3.5) it is "d/M/yyyy" . It is causing me tons of trouble. I could solve the issue by setting the patterns by

String was not recognized as a valid DateTime?

家住魔仙堡 提交于 2019-12-01 20:47:29
I try to convert string to datetime but each time I get : String was not recognized as a valid DateTime. Code is: string format = "dd/MM/yyyy"; obj.TransDate = DateTime.ParseExact(lbl_TransDate.Text.Split('/')[0] + "/" + lbl_TransDate.Text.Split('/')[1] + "/" + lbl_TransDate.Text.Split('/')[2], format, CultureInfo.InvariantCulture); When I debug the date which I try to parse it is : 12/4/2012 The desired format is string format = "dd/M/yyyy"; I don't understand a thing though, why split an concatenate the string, since you would obtain the same thing? If the input is 12/4/2012 , after the

What is setting CultureInfo.CurrentCulture

巧了我就是萌 提交于 2019-12-01 18:30:31
问题 If I do a Console.WriteLine(System.Globalization.CultureInfo.CurrentCulture.ToString()); get "en-US" What should I change in my control panel settings ( Region and Language ? ) to get something else for example "en-CA" . 回答1: In my experience, the culture was set by the version of the operating system. Not really a setting in the control panel. We used to have to have multiple VM's running multiple version of Windows to test our cultural based features 回答2: What should I change in my control

What is setting CultureInfo.CurrentCulture

六眼飞鱼酱① 提交于 2019-12-01 17:59:07
If I do a Console.WriteLine(System.Globalization.CultureInfo.CurrentCulture.ToString()); get "en-US" What should I change in my control panel settings ( Region and Language ? ) to get something else for example "en-CA" . In my experience, the culture was set by the version of the operating system. Not really a setting in the control panel. We used to have to have multiple VM's running multiple version of Windows to test our cultural based features What should I change in my control panel settings ( Region and Language ? ) to get something else for example "en-CA" . You can change it for