NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DateTime Constructor (Int32, Int32, Int32, Int32, Int32, Int32, Int32, Calendar)

Initializes a new instance of the DateTime class using a specified year, month, day, hour, minute, second, and millisecond for the specified calendar.

[Visual Basic]
Overloads Public Sub New( _
   ByVal year As Integer, _
   ByVal month As Integer, _
   ByVal day As Integer, _
   ByVal hour As Integer, _
   ByVal minute As Integer, _
   ByVal second As Integer, _
   ByVal millisecond As Integer, _
   ByVal calendar As Calendar _
)
[C#]
public DateTime(
   int year,
   int month,
   int day,
   int hour,
   int minute,
   int second,
   int millisecond,
   Calendar calendar
);
[C++]
public: DateTime(
   int year,
   int month,
   int day,
   int hour,
   int minute,
   int second,
   int millisecond,
   Calendar* calendar
);
[JScript]
public function DateTime(
   year : int,
   month : int,
   day : int,
   hour : int,
   minute : int,
   second : int,
   millisecond : int,
   calendar : Calendar
);

Parameters

year
The year (1 through 9999).
month
The month (1 through 12).
day
The day (1 through 31).
hour
The hours (0 through 23).
minute
The minutes (0 through 59).
second
The seconds (0 through 59).
millisecond
The milliseconds, as a floating point value.
calendar
The Calendar where the DateTime object is to represent a value.

Exceptions

Exception Type Condition
ArgumentException If the calendar is a null reference (in Visual Basic Nothing).
ArgumentException If the year is less than 1 or greater than 9999.
ArgumentException If the month specifies a value outside the range of the specified calendar.
ArgumentException If the day is less than 1 or greater than the number of days in the specified month.
ArgumentException If the hour is less than 0 or greater than 23 .
ArgumentException If the minute is less than 0 or greater than 59 .
ArgumentException If the second is less than 0 or greater than 59 .
ArgumentException If the millisecond is rounded up to the nearest integer.

Remarks

This DateTime class initializes a new instance of the DateTime that uses a specified year, month, day, hour, minute, second, and millisecond for the specified calendar.

The allowable parameter values are:

An exception is thrown if the calendar arguments are out of range for the specified calendar or if it is not possible to represent the given arguments as a DateTime value. This is dependent upon the specified calendar. For example, if the GregorianCalendar calendar is used, the value of day cannot be 8.

The Calendar package provides implementation of the Gregorian, JulianCalendar, and other calendars.

An exception is thrown if milliseconds is less than the minimum ticks or greater than the maximum ticks.

See Also

DateTime Structure | DateTime Members | System Namespace | DateTime Constructor Overload List | Int32 | Calendar