This documentation is archived and is not being maintained.

DateTimeOffset Constructor (Int32, Int32, Int32, Int32, Int32, Int32, Int32, Calendar, TimeSpan)

Initializes a new instance of the DateTimeOffset structure using the specified year, month, day, hour, minute, second, millisecond, and offset of a specified calendar.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

	int year, 
	int month, 
	int day, 
	int hour, 
	int minute, 
	int second, 
	int millisecond, 
	Calendar^ calendar, 
	TimeSpan offset


Type: System::Int32
The year.
Type: System::Int32
The month (1 through 12).
Type: System::Int32
The day (1 through the number of days in month).
Type: System::Int32
The hours (0 through 23).
Type: System::Int32
The minutes (0 through 59).
Type: System::Int32
The seconds (0 through 59).
Type: System::Int32
The milliseconds (0 through 999).
Type: System.Globalization::Calendar
The calendar that is used to interpret year, month, and day.
Type: System::TimeSpan
The time's offset from Coordinated Universal Time (UTC).


offset does not represent whole minutes.


calendar cannot be nullptr.


year is less than the calendar parameter's MinSupportedDateTime.Year or greater than MaxSupportedDateTime.Year.


month is either less than or greater than the number of months in year in the calendar.


day is less than one or greater than the number of days in month.


hour is less than zero or greater than 23.


minute is less than 0 or greater than 59.


second is less than 0 or greater than 59.


millisecond is less than 0 or greater than 999.


offset is less than -14 hours or greater than 14 hours.


The year, month, and day parameters cannot be represented as a date and time value.


The UtcDateTime property is earlier than DateTimeOffset::MinValue or later than DateTimeOffset::MaxValue.

The year, month, day, hour, minute, second, and millisecond parameters all reflect values expressed in the calendar specified by the calendar parameter. An exception is thrown if these values form a date and time that cannot be expressed by using this calendar.

The following example uses instances of both the HebrewCalendar class and the HijriCalendar class to instantiate a DateTimeOffset value. That date is then displayed to the console using the respective calendars and the Gregorian calendar.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5 SP1, 3.0 SP1, 2.0 SP1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.