Create date of 1/13/2009 using Hijri calendar and get Day property from DateTime : Calendar « Date Time « C# / C Sharp






Create date of 1/13/2009 using Hijri calendar and get Day property from DateTime

 

using System;
using System.Globalization;


public class MainClass{

   public static void Main()  {
        DateTime dateGregorian = new DateTime(2009, 1, 13);
        Console.WriteLine(dateGregorian.Day);              
        
        // Create date of 1/13/2009 using Hijri calendar.
        HijriCalendar hijri = new HijriCalendar();
        DateTime dateHijri = new DateTime(1430, 1, 17, hijri);
        // Return day of date created using Hijri calendar.
        Console.WriteLine(dateHijri.Day);                    
        
        // Display day of date in Hijri calendar.
        Console.WriteLine(hijri.GetDayOfMonth(dateHijri));   
   }
}

   
  








Related examples in the same category

1.Calendar ToDateTime is not culture aware
2.ToString(): make it culture aware
3.Two Digit Year Max
4.To Four Digit Year
5.Calendar represents time in divisions, such as weeks, months, and years.
6.Add to year, month, week, day, hour, minute, second and millisecton
7.DateTime(Int32, Int32, Int32, Calendar): Create a DateTime structure to the specified year, month, and day for the specified calendar.
8.Using the Hijri Calendar
9.Using the Persian Calendar