I have a function that returns step size from a limited range. Therefore, if the range is {1,2,3,4,5,6, .10}, and I want 5 steps, it will return the size of step 2. This is not so difficult.
If I have {.1, .2, .3, .4 .... 1} and I want 7 steps, the step size is 0.14285. Then I want to convert 0.14285 to the nearest relevant time dimension. In this case, .14285 is a fractional day. For example, the integer 1 would represent the whole day, and .25 would represent 6 hours.
.14285 = 12,342.24 seconds = 205.704 Minutes = 3.42 Hours ~= 4 hours.
Then I want to bind .14285 to (4 * 60 * 60 = 14,400 / (24 * 60 * 60)) = .16666, which is the decimal equivalent in 4 hours.
I have more or less calculated math, but I wonder if there is an easier way to do this using DateTime stuff?
source
share