T
T
The Denshush2015-12-04 23:15:32
.NET
The Denshush, 2015-12-04 23:15:32

C# uniform date format?

I'm new to C#, please advise where you can read about changing the time format.
Well, let's say in Russian language Windows dd / mm / yyyy, and in American mm / dd / yyyy
I wonder if it's possible to somehow set a single date format for the entire application ....
If possible, explain how for a teapot with examples and pictures ))) ), if not, then at least with the documentation (which is impossible to read) and with explanations.
Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Vitrenko, 2015-12-05
@Vestail

For .NET <= 4.5.2

using System.Threading;
using System.Globalization;
//code
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

For .NET > 4.5.2
using System.Globalization;
//code
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;

D
Dmitry Kovalsky, 2015-12-04
@dmitryKovalskiy

https://msdn.microsoft.com/ru-ru/library/system.gl... There is such a thing. Actually, at the start of your application, you can assign any custom culture to it. Or use some specific locale like ru-ru.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question