Home Cooker Classes Others Rice CookerGX
Classes  >  datetime  >  AddHours(int)
datetime class : AddHours(int) method

Description

Gets the new datetime instance which is obtained by adding the number of hours to the invoker instance.

Syntax

datetimeInstance.AddHours(int numberOfHours)

Arguments

ClassNameDescription
intnumberOfHoursNumber of hours

Return value

ClassDescription
datetimeNew datetime type instance which is obtained by adding the argument.

Sample code

datetime dt = new datetime(2016, 3, 4, 4, 13, 0);

datetime addHour1 = dt.AddHours(5);//2016/03/04 9:13:00

datetime addHour2 = dt.AddHours(-5);//2016/03/03 23:13:00

Notes

System.DateTime.AddHours(Double)のラッパーです。

It's a wrapper of the System.DateTime.AddHours(Double).

Links for reference

Copyright © Rice All rights reserved.