A dynamic time span is the definition of a time span (a lower value and a upper value) based on the current point in time and rules that derive a lower timestamp and an upper timestamp from the current point in time.
The effective time span is evaluated on access i.e. when it is used. When a dynamic time span is evaluated, the current timestamp is first transformed into a base timestamp using given adjustment rules and then the lower and upper boundary of the time span is calculated based on this base timestamp using the specified offset values.
Definition of a dynamic time span
A dynamic time span definition specifies how the current timestamp is adjusted to get the base time stamp
1.Base timestamp adjustment part: Defines which part of the date time is adjusted, options are: None, Minute, Hour, Day, Week, Month or Year
2.Basic timestamp adjustment type : Defines if the how the current timestamp adjusted to the part defined with adjustment part.
3.Lower boundary offset type: Defines the unit of the offset value for the lower boundary. Options are months and time span (days, hours, minutes, seconds)
4.Lower boundary offset value: Value that is subtracted from the basic timestamp to calculate the lower boundary of the dynamic time span. Negative values can be used to dynamically form a lower boundary in the future.
5.Upper boundary offset type: Defines the unit of the offset value for the upper boundary. Options are months and time span (days, hours, minutes, seconds)
6.Upper boundary offset value: Value that is subtracted from the basic timestamp to calculate the upper boundary of the dynamic time span. Negative values can be used to dynamically form a upper boundary in the future.
Adjustment of the current timestamp to a basic timestamp
The basic timestamp is the timestamp on which the calculation of the lower and upper boundary of the dynamic time span are based. The basic timestamp itself is derived from the date and time when the dynamic time span was accessed by using following adjustment types and adjustment part.
Adjustment methods
•None: base timestamp becomes current timestamp
•Round: The current timestamp is rounded according to the adjustment type. . E.g. If the current timestamp is 2015-01-12 21:15:02.12, the adjustment type is round and the adjustment part is hours the resulting base timestamp would be 2015-01-12 21:00:00.00.
•Ceiling: The current timestamp is set to the next full unit according to the adjustment type. E.g. If the current timestamp is 2015-01-12 21:15:02.12, the adjustment type is ceiling and the adjustment part is month the resulting base timestamp would be 2015-02-01 00:00:00.00.
•Floor: The current timestamp is being set to the previous full unit according to the adjustment type. E.g. If the current timestamp is 2015-01-12 21:15:02.12, the adjustment type is floor and the adjustment part is minutes the resulting base timestamp would be 2015-01-12 21:15:00.00.
Adjustment parts
•Year: Year part of the date will be adjusted. Rounding a year checks today to which half does it belong. If today belongs in first half of the year then use current year, else use beginning of next year.
•Month: Adjust the month part. Floor and ceiling simply uses beginning of current and next month respectively. While round checks if today is in first half of the current month, if true then rounds to the beginning of current month. Otherwise use the beginning of next month.
•Week: When adjusting the current time span using week as adjustment type the system always uses first day of the week based on the user's culture.
•Day: Floor and ceiling moves the time stamp to the beginning of today and the beginning to tomorrow. Rounding checks if the half of the day has passed, if so use beginning of tomorrow, else use beginning of today.
•Hour: Floor and ceiling an hour works as expected(beginning of current and next hour). Rounding checks if half of the current hour is passed already, if so use next hour. Otherwise use the beginning of current hour.
•Minute: Adjusting the minutes adjust the minute part of the time. If floored uses the beginning of current minute, ceiling uses the beginning of next minute. Rounding check the seconds, If 30 seconds has passed in the current minute, use the beginning of next minute. If current time is within the first 30 second, then system uses the beginning of current minute.
Calculation of the lower and upper time span boundary
Based on the basic timestamp the system computes the lower and upper boundary of the time span using the given offset type and offset offset values. The offset values are subtracted from the basic timestamp therefore to specify lower or upper boundaries in the future negative offsets have to be used.
The calculation of a dynamic time span will internally create a static time span with non-empty lower and upper boundaries and lower and upper boundary included in the time span.