xtd 0.2.0
Loading...
Searching...
No Matches

◆ add_seconds()

date_time xtd::date_time::add_seconds ( double  value) const

Returns a new xtd::date_time that adds the specified number of seconds to the value of this instance.

Parameters
valueA number of whole and fractional seconds. The value parameter can be negative or positive.
Returns
An object whose value is the sum of the date and time represented by this instance and the number of seconds represented by value.
Exceptions
xtd::argument_out_of_range_exceptionThe resulting xtd::date_time is less than xtd::date_time::min_value or greater than xtd::date_time::max_value.
Examples
The following example uses the xtd::date_time::add_seconds method to add 30 seconds and the number of seconds in one day to a xtd::date_time value. It then displays each new value and displays the difference between it and the original value. The difference is displayed both as a time span and as a number of ticks.
Remarks
This method does not change the value of this xtd::date_time. Instead, it returns a new xtd::date_time whose value is the result of this operation.
The fractional part of value is the fractional part of a second. For example, 4.5 is equivalent to 4 seconds, 500 milliseconds, and 0 ticks.