RepeatPeriodHelper Class
Namespace: PTS.Chronometry
Assembly: PTS.Chronometry.dll
Provides methods for RepeatPeriod type.
Syntax
public static class RepeatPeriodHelper
Inheritance
Methods
AddPeriod(DateTime, RepeatPeriod)
Increases the DateTime
value by specified time block size.
Declaration
public static DateTime AddPeriod(DateTime dateTime, RepeatPeriod period)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dateTime | The |
RepeatPeriod | period | The size of the time block to add to the specified |
Returns
Type | Description |
---|---|
System.DateTime | A new instance of |
SubtractPeriod(DateTime, RepeatPeriod)
Decreases the DatetDime
by the specidied block size.
Declaration
public static DateTime SubtractPeriod(DateTime dateTime, RepeatPeriod period)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dateTime | The |
RepeatPeriod | period | The size of the time block to remove from the specified |
Returns
Type | Description |
---|---|
System.DateTime | A new instance of |
ToTimeSlots(RepeatPeriod, Nullable<DateTime>, Nullable<DateTime>, Int32)
Produes collection of DateTime
types delineating the start times for blocks of size specified by period parameter.
Declaration
public static List<DateTime> ToTimeSlots(this RepeatPeriod period, DateTime? until, DateTime? from = default(DateTime? ), int slotSize = 1)
Parameters
Type | Name | Description |
---|---|---|
RepeatPeriod | period | Time block size. |
System.Nullable<System.DateTime> | until | The cut off DateTime specifying the upper boundary for newly generated collection. |
System.Nullable<System.DateTime> | from | Starting time of the time block sequence. |
System.Int32 | slotSize | Size multiplier of specified time block size. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.DateTime> | Collection of DateTime values each representing the start time of a block of specified size. |