DateTime.DateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, DateTimeKind) Constructor
Assembly: mscorlib (in mscorlib.dll)
public: DateTime ( int year, int month, int day, int hour, int minute, int second, int millisecond, DateTimeKind kind )
public DateTime ( int year, int month, int day, int hour, int minute, int second, int millisecond, DateTimeKind kind )
public function DateTime ( year : int, month : int, day : int, hour : int, minute : int, second : int, millisecond : int, kind : DateTimeKind )
Not applicable.
Parameters
- year
The year (1 through 9999).
- month
The month (1 through 12).
- day
The day (1 through the number of days in month).
- hour
The hours (0 through 23).
- minute
The minutes (0 through 59).
- second
The seconds (0 through 59).
- millisecond
The milliseconds (0 through 999).
- kind
One of the DateTimeKind values that indicates whether year, month, day, hour, minute, second, and millisecond specify a local time, Coordinated Universal Time (UTC), or neither.
| Exception type | Condition |
|---|---|
| year is less than 1 or greater than 9999. -or- month is less than 1 or greater than 12. -or- day is less than 1 or greater than the number of days in month. -or- hour is less than 0 or greater than 23. -or- minute is less than 0 or greater than 59. -or- second is less than 0 or greater than 59. -or- millisecond is less than 0 or greater than 999. | |
| The specified time parameters evaluate to less than MinValue or more than MaxValue. -or- kind is not one of the DateTimeKind values. |
For applications in which portability of date and time data or a limited degree of time zone awareness is important, you can use the corresponding DateTimeOffset constructor.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.