Table of Contents

Round Method

Definition

Namespace
Cuemon.Extensions
Assemblies
Cuemon.Extensions.Core.dll
Source
src/Cuemon.Extensions.Core/DateTimeExtensions.cs

Round(DateTime, double, TimeUnit, VerticalDirection)

Returns a DateTime value that is rounded either towards negative infinity or positive infinity.

public static DateTime Round(this DateTime value, double interval, TimeUnit timeUnit, VerticalDirection direction)

Parameters

value DateTime

The DateTime to extend.

interval double

The double value that in combination with timeUnit specifies the rounding of value.

timeUnit TimeUnit

One of the enumeration values that specifies the time unit of interval.

direction VerticalDirection

One of the enumeration values that specifies the direction of the rounding.

Returns

DateTime

A DateTime value that is rounded either towards negative infinity or positive infinity.

Exceptions

ArgumentOutOfRangeException

direction is an invalid enumeration value.

ArgumentOutOfRangeException

interval is Zero.

Round(DateTime, TimeSpan, VerticalDirection)

Returns a DateTime value that is rounded either towards negative infinity or positive infinity.

public static DateTime Round(this DateTime value, TimeSpan interval, VerticalDirection direction)

Parameters

value DateTime

The DateTime to extend.

interval TimeSpan

The TimeSpan value that specifies the rounding of value.

direction VerticalDirection

One of the enumeration values that specifies the direction of the rounding.

Returns

DateTime

A DateTime value that is rounded either towards negative infinity or positive infinity.

Exceptions

ArgumentOutOfRangeException

direction is an invalid enumeration value.

ArgumentOutOfRangeException

interval is Zero.