How to convert a C # DateTime value to something like January 31, 2009, but in Polish?

How to convert DateTime.Now (or basically any other DateTime format) to some January 31st, 2009 (although I would like it to be polished, so I need Styczeń 2009). Do I need to create an array and check the number with this array every month or is there a built-in function to save the day?

Concerning,

Madboy

+4
source share
2 answers
CultureInfo polish = new CultureInfo("pl-PL"); // I *think* this is Polish -- you might need to check! DateTime.Now.ToString("d MMMM yyyy", polish); 

CultureInfo already knows the names of the months in different locales - if you need this information explicitly, for example. to print a list of month names, you can get it from the DateTimeFormatInfo class, but for a simple formatting requirement, it's easier to just use DateTime.ToString with the desired culture and format string.

+7
source

I formatted it using a DateTimeFormat with a Culture or Locale variable. Date abstraction does not depend on how it is rendered.

0
source

Source: https://habr.com/ru/post/1301210/


All Articles