Class1.cs
上传用户:lxycoco
上传日期:2022-07-21
资源大小:38457k
文件大小:1k
源码类别:

C#编程

开发平台:

Others

  1. using System;
  2. using System.Threading;
  3. using System.Globalization;
  4. namespace Wrox.ProCSharp.Localization
  5. {
  6. class Class1
  7. {
  8. static void Main(string[] args)
  9. {
  10. DateTime d = new DateTime(2003, 08, 09);
  11. // current culture
  12. System.Console.WriteLine(d.ToLongDateString());
  13. // use IFormatProvider
  14. Console.WriteLine(d.ToString("D", new CultureInfo("fr-FR")));
  15. // use culture of thread
  16. CultureInfo ci = Thread.CurrentThread.CurrentCulture;
  17. Console.WriteLine(ci.ToString() + ": " + d.ToString("D"));
  18. ci = new CultureInfo("es-ES");
  19. Thread.CurrentThread.CurrentCulture = ci;
  20. Console.WriteLine(ci.ToString() + ": " + d.ToString("D"));
  21. }
  22. }
  23. }