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

Description

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

Syntax

datetimeInstance.AddSeconds(int numberOfSeconds)

Arguments

ClassNameDescription
intnumberOfSecondsNumber of seconds

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 addSecond1 = dt.AddSeconds(5);//2016/03/04 4:13:05

datetime addSecond2 = dt.AddSeconds(-5);//2016/03/04 4:12:55

Notes

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

Links for reference

Copyright © Rice All rights reserved.