/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/fundamentals/runtime-libraries/snippets/System.Globalization/DateTimeFormatInfo/csharp/example1.cs
30 строк
1 KB
Genevieve Warren
Extract remarks for System.Globalization* (#38912)
29 дек 2023, 20:03
Не верифицирован
29 дек 2023, 20:03
7f945f9
Код
Авторство
О чём код?
// <Snippet10> using System; using System.Globalization; public class Example1 { public static void Main() { DateTime dateValue = new DateTime(2013, 8, 18); CultureInfo enUS = CultureInfo.CreateSpecificCulture("en-US"); DateTimeFormatInfo dtfi = enUS.DateTimeFormat; Console.WriteLine("Before modifying DateTimeFormatInfo object: "); Console.WriteLine("{0}: {1}\n", dtfi.ShortDatePattern, dateValue.ToString("d", enUS)); // Modify the short date pattern. dtfi.ShortDatePattern = "yyyy-MM-dd"; Console.WriteLine("After modifying DateTimeFormatInfo object: "); Console.WriteLine("{0}: {1}", dtfi.ShortDatePattern, dateValue.ToString("d", enUS)); } } // The example displays the following output: // Before modifying DateTimeFormatInfo object: // M/d/yyyy: 8/18/2013 // // After modifying DateTimeFormatInfo object: // yyyy-MM-dd: 2013-08-18 // </Snippet10>