CultureInfo.DateTimeFormat
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Text;
using System.Threading;
using System.Globalization;
public class MainClass
{
public static void Main()
{
string[] cultures = new string[] { "en-US", "en-GB", "es-MX", "de-DE", "ja-JP" };
using (TextWriter sw = Console.Out)
{
foreach (string c in cultures)
{
CultureInfo ci = new CultureInfo(c);
DateTime dt = new DateTime(1980, 9, 12, 0, 30, 55);
sw.WriteLine("Short Date Example: {0}", dt.ToString(ci.DateTimeFormat.ShortDatePattern, ci.DateTimeFormat));
sw.WriteLine("Long Date Example: {0}", dt.ToString(ci.DateTimeFormat.LongDatePattern, ci.DateTimeFormat));
}
}
}
}
Related examples in the same category