Set Culture to current thread : CultureInfo I18N : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » CultureInfo I18N »

 

Set Culture to current thread









    


using System;
using System.Globalization;
using System.Threading;

class Class1 {
  static void Main(string[] args) {
      CultureInfo MyCulture = new CultureInfo("fr-FR");
      DateTime MyDate = System.DateTime.Now;

      Thread.CurrentThread.CurrentCulture = MyCulture;

      DateTimeFormatInfo dtf = MyCulture.DateTimeFormat;
      //Change date and time separator
      dtf.DateSeparator = "\\";
      dtf.TimeSeparator = "&";

      Console.WriteLine();
      Console.WriteLine(MyDate.ToLongDateString());
      Console.WriteLine(MyDate.ToLongTimeString());
      Console.WriteLine(MyDate.ToShortDateString());
      Console.WriteLine(MyDate.ToShortTimeString());
   }
}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» CultureInfo I18N