在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1 class Program 2 { 3 static void Main(string[] args) 4 { 5 DateTime dt = DateTime.Now; 6 DateTimeFormatInfo dfi = new DateTimeFormatInfo(); 7 CultureInfo ci = new CultureInfo("nl-BE"); 8 9 //use the DateTimeFormat from the culture associated with 10 //the current thread 11 Console.WriteLine(dt.ToString("d")); 12 Console.WriteLine(dt.ToString("D")); 13 14 //use the DateTimeFormat from the specific culture passed 15 Console.WriteLine(dt.ToString("F", ci)); 16 17 //make up a new custom DateTime pattern, ans use it 18 dfi.MonthDayPattern = "MM-MMMM, ddd-dddd"; 19 Console.WriteLine(dt.ToString("m", dfi)); 20 21 //reset the current thread to a different culture 22 Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-BE"); 23 Console.WriteLine(dt.ToString("d")); 24 25 }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论