DateTime: Utilisation du Calendrier Persan

Author:


{filelink=19646}

using System;
using System.Globalization;

public class ExemplePersan
{
   public static void Main()
   {

      PersianCalendar persan = new PersianCalendar();
      DateTime date = DateTime.Now;
      // Affichage de la date du calendrier Grégorien
      Console.WriteLine(date.ToString());
      // Afficher la Date Persan
      Console.WriteLine("{0}/{1}/{2} {3}{6}{4:D2}{6}{5:D2}",
                                       persan.GetMonth(date),
                                       persan.GetDayOfMonth(date),
                                       persan.GetYear(date),
                                       persan.GetHour(date),
                                       persan.GetMinute(date),
                                       persan.GetSecond(date),
                                       DateTimeFormatInfo.CurrentInfo.TimeSeparator);

   }

}

Leave a Reply

Your email address will not be published. Required fields are marked *