Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Affichage des Date selon les cultures


{filelink=19651}

using System;
using System.Globalization;
using System.Threading;
 
class DateCulture
{
    static void Main()
    {
        DateTime date = DateTime.Now;
        Console.WriteLine(date.ToLongDateString());
 
        // Date en 'culture' française
        Console.WriteLine(date.ToString("D", new CultureInfo("fr-FR")));
        CultureInfo ci = Thread.CurrentThread.CurrentCulture;
        Console.WriteLine(ci.ToString() + ": " + date.ToString("D"));
 
        // Date en 'culture' Espagnole
        ci = new CultureInfo("es-ES");
        Thread.CurrentThread.CurrentCulture = ci;
        Console.WriteLine(ci.ToString() + ": " + date.ToString("D"));
 
        // Date en 'culture' Allemande
        ci = new CultureInfo("de-DE");
        Thread.CurrentThread.CurrentCulture = ci;
        Console.WriteLine(ci.ToString() + ": " + date.ToString("D"));
 
        // Date en 'culture' Arabe Syrienne
        ci = new CultureInfo("ar-SY");
        Thread.CurrentThread.CurrentCulture = ci;
        Console.WriteLine(ci.ToString() + ": " + date.ToString("D"));
    }
}

No comments yet.

Leave a Comment