Class DateTimeUtilityExtensions
This is an extension implementation of the most common methods on the DateTimeUtility class.
Inheritance
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public static class DateTimeUtilityExtensions
Methods
| Improve this DocCeiling(DateTime, Double, TimeUnit)
Returns a System.DateTime value that is rounded towards positive infinity.
Declaration
public static DateTime Ceiling(this DateTime value, double interval, TimeUnit timeUnit)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | value | A System.DateTime value to be rounded. |
System.Double | interval | The System.Double value that in combination with |
TimeUnit | timeUnit | One of the enumeration values that specifies the time unit of |
Returns
Type | Description |
---|---|
System.DateTime | A System.DateTime value that is rounded towards positive infinity. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|
Ceiling(DateTime, TimeSpan)
Returns a System.DateTime value that is rounded towards positive infinity.
Declaration
public static DateTime Ceiling(this DateTime value, TimeSpan interval)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | value | A System.DateTime value to be rounded. |
System.TimeSpan | interval | The System.TimeSpan value that specifies the rounding of |
Returns
Type | Description |
---|---|
System.DateTime | A System.DateTime value that is rounded towards positive infinity. |
Floor(DateTime, Double, TimeUnit)
Returns a System.DateTime value that is rounded towards negative infinity.
Declaration
public static DateTime Floor(this DateTime value, double interval, TimeUnit timeUnit)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | value | A System.DateTime value to be rounded. |
System.Double | interval | The System.Double value that in combination with |
TimeUnit | timeUnit | One of the enumeration values that specifies the time unit of |
Returns
Type | Description |
---|---|
System.DateTime | A System.DateTime value that is rounded towards negative infinity. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|
Floor(DateTime, TimeSpan)
Returns a System.DateTime value that is rounded towards negative infinity.
Declaration
public static DateTime Floor(this DateTime value, TimeSpan interval)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | value | A System.DateTime value to be rounded. |
System.TimeSpan | interval | The System.TimeSpan value that specifies the rounding of |
Returns
Type | Description |
---|---|
System.DateTime | A System.DateTime value that is rounded towards negative infinity. |
Round(DateTime, Double, TimeUnit, VerticalDirection)
Returns a System.DateTime value that is rounded either towards negative infinity or positive infinity.
Declaration
public static DateTime Round(this DateTime value, double interval, TimeUnit timeUnit, VerticalDirection direction)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | value | A System.DateTime value to be rounded. |
System.Double | interval | The System.Double value that in combination with |
TimeUnit | timeUnit | One of the enumeration values that specifies the time unit of |
VerticalDirection | direction | One of the enumeration values that specifies the direction of the rounding. |
Returns
Type | Description |
---|---|
System.DateTime | A System.DateTime value that is rounded either towards negative infinity or positive infinity. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|
System.ArgumentOutOfRangeException |
|
Round(DateTime, TimeSpan, VerticalDirection)
Returns a System.DateTime value that is rounded either towards negative infinity or positive infinity.
Declaration
public static DateTime Round(this DateTime value, TimeSpan interval, VerticalDirection direction)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | value | A System.DateTime value to be rounded. |
System.TimeSpan | interval | The System.TimeSpan value that specifies the rounding of |
VerticalDirection | direction | One of the enumeration values that specifies the direction of the rounding. |
Returns
Type | Description |
---|---|
System.DateTime | A System.DateTime value that is rounded either towards negative infinity or positive infinity. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|
System.ArgumentOutOfRangeException |
|