Returns the DateTime resulting from adding a fractional number of hours to the specified DateTime.
[Visual Basic] Overridable Public Function AddHours( _ ByVal time As DateTime, _ ByVal hours As Integer _ ) As DateTime [C#] public virtual DateTime AddHours( DateTime time, int hours ); [C++] public: virtual DateTime AddHours( DateTime time, int hours ); [JScript] public function AddHours( time : DateTime, hours : int ) : DateTime;
The DateTime resulting from adding the specified fractional number of hours to the specified DateTime.
Exception Type | Condition |
---|---|
ArgumentException | is thrown if the resulting DateTime is outside the supported range. |
The result is computed by rounding the fractional number of hours specified by hours to the nearest millisecond, and adding that interval to the specified DateTime. The hours argument is permitted to be negative.
Calendar Class | Calendar Members | System.Globalization Namespace