Version

GetWeekNumberForLastDayOfMonth Method

Returns the week number for the last day of a particular month and year.
Syntax
'Declaration
 
Public Function GetWeekNumberForLastDayOfMonth( _
   ByVal month As Integer, _
   ByVal year As Integer _
) As Integer
public int GetWeekNumberForLastDayOfMonth( 
   int month,
   int year
)

Parameters

month
Month number
year
Year number

Return Value

Week number containing the last day of the month and year specified using the WeekRule and FirstDayOfWeekResolved.
Example
This example uses the GetWeekNumberForFirstDayOfMonth and GetWeekNumberForLastDayOfMonth methods to determine the week numbers of the first and last day of the current month.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.IO
Imports System.Globalization

    Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

        Dim weekNumberFirstDayInMonth As Integer
        Dim weekNumberLastDayInMonth As Integer

        '	Get the week numbers of the first and last day in the current month
        weekNumberFirstDayInMonth = Me.ultraCalendarInfo1.GetWeekNumberForFirstDayOfMonth(DateTime.Today.Month, DateTime.Today.Year)
        weekNumberLastDayInMonth = Me.ultraCalendarInfo1.GetWeekNumberForLastDayOfMonth(DateTime.Today.Month, DateTime.Today.Year)

        '	Display the information in a message box
        Dim info As String = String.Empty
        info += "The week number of the first day in the current month is " + weekNumberFirstDayInMonth.ToString() + vbCrLf
        info += "The week number of the last day in the current month is " + weekNumberLastDayInMonth.ToString() + vbCrLf

        MessageBox.Show(info, "GetWeekNumberForFirstDayOfMonth/GetWeekNumberForLastDayOfMonth", MessageBoxButtons.OK)

    End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.IO;
using System.Globalization;

		private void button1_Click(object sender, System.EventArgs e)
		{

			int weekNumberFirstDayInMonth;
			int weekNumberLastDayInMonth;

			//	Get the week numbers of the first and last day in the current month
			weekNumberFirstDayInMonth = this.ultraCalendarInfo1.GetWeekNumberForFirstDayOfMonth( DateTime.Today.Month, DateTime.Today.Year );
			weekNumberLastDayInMonth = this.ultraCalendarInfo1.GetWeekNumberForLastDayOfMonth( DateTime.Today.Month, DateTime.Today.Year );

			//	Display the information in a message box
			string info = string.Empty;
			info += "The week number of the first day in the current month is " + weekNumberFirstDayInMonth.ToString() + "\n";
			info += "The week number of the last day in the current month is " + weekNumberLastDayInMonth.ToString() + "\n";

			MessageBox.Show( info, "GetWeekNumberForFirstDayOfMonth/GetWeekNumberForLastDayOfMonth", MessageBoxButtons.OK );

		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also