Questions tagged [cultureinfo]

Represents information about a specific culture including the names of the culture, the writing system, and the calendar used, as well as access to culture-specific objects that provide information for common operations, such as formatting dates and sorting strings.

Represents information about a specific culture including the names of the culture, the writing system, and the calendar used, as well as access to culture-specific objects that provide information for common operations, such as formatting dates and sorting strings.

Reference

CultureInfo on MSDN

1135 questions
12
votes
5 answers

Finding weekend days based on culture

Is there a way to find the days that constitute a weekend or workweek based on different cultures using the .NET framework? For example, some Muslim countries have a workweek from Sunday through Thursday.
sduplooy
  • 14,340
  • 9
  • 41
  • 60
12
votes
3 answers

Why is my CurrentCulture en-GB and my CurrentUICulture en-US

I have a C# application which has to run on machines with different culture settings. No problem I thought, it will just lookup on start up what the current culture is on the machine, and do everything for me. Well no, it would seam that something…
SnAzBaZ
  • 6,389
  • 4
  • 23
  • 22
12
votes
2 answers

Change culture based on a link MVC4

I have a curiosity related to culture change in MVC. I tried in 2 ways, but apparently I was wrong somewhere. In my Web.config I have : This is how I tried to change the thread culture : …
Cosmin
  • 2,184
  • 21
  • 38
12
votes
3 answers

Can CultureInfo.CurrentCulture ever be null?

Can CultureInfo.CurrentCulture ever be null? A null value would crash my program, which I don't want. So I'm asking, to be safe, do I need to do? var culture = CultureInfo.CurrentCulture ?? CultureInfo.InvariantCulture
Colonel Panic
  • 132,665
  • 89
  • 401
  • 465
12
votes
3 answers

CultureInfo & DateTimeInfo: How to check if is 24 hour time?

I'm modifying a globalized web application which uses stored CultureInfo for each logged in user. The client would like time data entry to be localized. Displaying is not a problem as the formatting is already available. However I need to detect if…
toxaq
  • 6,745
  • 3
  • 46
  • 56
12
votes
2 answers

Does DateTime.ToString("s") return always same format?

According to MSDN on DateTime.ToString ToString("s") should always return string in the format of the sortable XML Schema style formatting, e.g.: 2008-10-01T17:04:32.0000000 In Reflector I came to this pattern inside DateTimeFormatInfo. public…
Peter Gfader
  • 7,673
  • 8
  • 55
  • 56
12
votes
3 answers

How to deal with accented characters in iOS SQLite?

I need to perform a SELECT queries that are insensitive to case and accents. For demo purposes, I create a table like that: create table table ( column text collate nocase ); insert into table values ('A'); insert into table values ('a'); insert…
Leandro Alves
  • 2,190
  • 3
  • 19
  • 24
11
votes
4 answers

Why isn't there a culture enum?

Greetings, I was wondering why there isn't a pre-set enum for cultures in C#? Since the cultures never change and are always like "nl-NL, en-GB, en-US".. why not make a enum for it to make things just a little bit easy'r ? [edit] As stated cultures…
Theun Arbeider
  • 5,259
  • 11
  • 45
  • 68
11
votes
7 answers

Culture sensitive ParseFloat Function in JavaScript?

Do anyone have suggestion for writing culture sensitive ParseFloat Function in JavaScript, So that when I have a string 100,000.22 in US culture format the parse float function returns 100000.22 whereas if I enter 100.000,22 in Swedish Culture it…
Faheem Ramzan
  • 111
  • 1
  • 1
  • 3
11
votes
1 answer

ASP.NET MVC (Async) CurrentCulture is not shared between Controller and View

I have an ASP.NET MVC 4 application that is targeting .NET Framework 4.7.1, with the problem that the culture is not shared between Controller and View, if the action contains async calls. I am referencing the NuGet package Microsoft.AspNet.Mvc…
11
votes
7 answers

Accessing resource strings with CultureInfo in .NET

Another simple questions. I have website with different languages. If I want to access a string from the resource file I would use it like this Resources.MyResourceFile.MyStringIdentifier Very easy. That way I know during compile time, that the…
11
votes
3 answers

Display current time in this format: HH:mm:ss

I'm having some trouble displaying the time in this format: HH:mm:ss. No matter what i try, i never get it in that format. I want the time in the culture of the Netherlands which is "nl-NL". This was one of my (although i forgot to keep the count)…
Yustme
  • 6,125
  • 22
  • 75
  • 104
11
votes
5 answers

CultureInfo thread safety

I have a multi-threaded application which parses some text and it needs to use English Culture Info for parsing numbers from this text. So, i do not want to create EngCulture everytime i call the parsing function. Currently i am passing EngCulture…
lockedscope
  • 965
  • 17
  • 45
11
votes
1 answer

int.Parse of "8" fails. int.Parse always requires CultureInfo.InvariantCulture?

We develop an established software which works fine on all known computers except one. The problem is to parse strings that begin with "8". It seems like "8" in the beginning of a string is a reserved character. Parsing: int.Parse("8") -> Exception…
Henrik Carlsson
  • 343
  • 1
  • 3
  • 8
11
votes
4 answers

Format decimal to string in correct culture info

What is the best way to format a decimal amount to string for UI display in the correct culture info?
c00ke
  • 2,245
  • 5
  • 26
  • 34