Version

ForceLatestTimeOfDay Method

Returns a DateTime corresponding with the last second of the day.
Syntax
'Declaration
 
Public Shared Function ForceLatestTimeOfDay( _
   ByVal dateTime As Date _
) As Date
public static DateTime ForceLatestTimeOfDay( 
   DateTime dateTime
)

Parameters

dateTime
DateTime indicating the day of the date to return.

Return Value

A DateTime corresponding with the last second of the day specified by dateTime.
Example
This example uses the static ForceEarliestTimeOfDay and ForceLatestTimeOfDay methods to set the MinDate and MaxDate properties such that the range of dates that will be accepted by the component is restricted to the current year.

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

        ' Declare 2 variables of type DateTime; 1 each for the first and last days of the year
        Dim earliest As DateTime = New DateTime(DateTime.Today.Year, 1, 1)
        Dim latest As DateTime = New DateTime(DateTime.Today.Year, 12, 31)

        ' Use the ForceEarliestTimeOfDay and ForceLatestTimeOfDay methods
        ' to adjust the Hour, Minute, Second, etc. properties of the dates
        '	so that the date range includes from midnight of the first day
        '	of the year through the last second of the last day of the year.
        earliest = UltraCalendarInfo.ForceEarliestTimeOfDay(DateTime.Today)
        latest = UltraCalendarInfo.ForceLatestTimeOfDay(DateTime.Today)

        '   Set the MinDate and MaxDate properties
        Me.ultraCalendarInfo1.MinDate = earliest
        Me.ultraCalendarInfo1.MaxDate = latest

    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)
		{

			//   Declare 2 variables of type DateTime; 1 each for the first and last days of the year
			DateTime earliest = new DateTime(DateTime.Today.Year, 1, 1);
			DateTime latest = new DateTime(DateTime.Today.Year, 12, 31);

			//   Use the ForceEarliestTimeOfDay and ForceLatestTimeOfDay methods
			//   to adjust the Hour, Minute, Second, etc. properties of the dates,
			//		so that the date range includes from midnight of the first day
			//		of the year through the last second of the last day of the year.
			earliest = UltraCalendarInfo.ForceEarliestTimeOfDay( DateTime.Today );
			latest = UltraCalendarInfo.ForceLatestTimeOfDay( DateTime.Today );

			//   Set the MinDate and MaxDate properties
			this.ultraCalendarInfo1.MinDate = earliest;
			this.ultraCalendarInfo1.MaxDate = latest;

		}
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