Initializes a new instance of the DateTime class using a specified year, month, day, hour, minute, second, and millisecond.
[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 _ ) [C#] public DateTime( int year, int month, int day, int hour, int minute, int second, int millisecond ); [C++] public: DateTime( int year, int month, int day, int hour, int minute, int second, int millisecond ); [JScript] public function DateTime( year : int, month : int, day : int, hour : int, minute : int, second : int, millisecond : int );
Exception Type | Condition |
---|---|
ArgumentException | If the year is less than 1 or greater than 9999. |
ArgumentException | If the month is less than 1 or greater than 12. |
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. |
This DateTime class initializes a new instance of the DateTime that uses a specified year, month, day, hour, minute, second, and millisecond.
The allowable parameter values are:
An exception is thrown if the milliseconds parameter is less than the minimum ticks or greater than the maximum ticks.
DateTime Structure | DateTime Members | System Namespace | DateTime Constructor Overload List | Int32