DateTime ToString with CultureInfo : Date Time Format : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » Date Time Format »

 

DateTime ToString with CultureInfo








    
 

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

class Program {
    static void Main(string[] args) {
        DateTime d = new DateTime(2005, 08, 09);
        Console.WriteLine(d.ToLongDateString());
        Console.WriteLine(d.ToString("D", new CultureInfo("fr-FR")));
        CultureInfo ci = Thread.CurrentThread.CurrentCulture;
        Console.WriteLine(ci.ToString() + ": " + d.ToString("D"));

        ci = new CultureInfo("es-ES");
        Thread.CurrentThread.CurrentCulture = ci;
        Console.WriteLine(ci.ToString() + ": " + d.ToString("D"));

    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» Date Time Format