GregorianCalendar.GetDayOfMonth : GregorianCalendar « Date Time « C# / C Sharp






GregorianCalendar.GetDayOfMonth

 

using System;
using System.Globalization;

public class SamplesGregorianCalendar  {
   public static void Main()  {
      DateTime myDT = new DateTime( 2010, 4, 3, new GregorianCalendar() );
      GregorianCalendar myCal = new GregorianCalendar();
      DisplayValues( myCal, myDT );
      myDT = myCal.AddYears( myDT, 2 );
      myDT = myCal.AddMonths( myDT, 10 );
      DisplayValues( myCal, myDT );
   }
   public static void DisplayValues( Calendar myCal, DateTime myDT )  {
      Console.WriteLine( "   Era:        {0}", myCal.GetEra( myDT ) );
      Console.WriteLine( "   Year:       {0}", myCal.GetYear( myDT ) );
      Console.WriteLine( "   Month:      {0}", myCal.GetMonth( myDT ) );
      Console.WriteLine( "   DayOfYear:  {0}", myCal.GetDayOfYear( myDT ) );
      Console.WriteLine( "   DayOfMonth: {0}", myCal.GetDayOfMonth( myDT ) );
      Console.WriteLine( "   DayOfWeek:  {0}", myCal.GetDayOfWeek( myDT ) );
      Console.WriteLine();
   }
}

   
  








Related examples in the same category

1.GregorianCalendar Class
2.GregorianCalendar Constructor
3.GregorianCalendar.AddMonths
4.GregorianCalendar.GetDaysInMonth
5.GregorianCalendar.GetDaysInYear
6.GregorianCalendar.GetMonthsInYear
7.GregorianCalendar.GetWeekOfYear
8.GregorianCalendar.IsLeapDay
9.GregorianCalendar.IsLeapMonth
10.GregorianCalendar.IsLeapYear
11.GregorianCalendar.MaxSupportedDateTime
12.GregorianCalendarTypes Enumeration