Results 1 to 1 of 1
Thread: offSet Epoch Timestamp Values
Dec 13, 2010, 09:45 #1
- Join Date
- May 2008
- Missouri, USA
- 0 Post(s)
- 0 Thread(s)
SOLVED | offSet Epoch Timestamp Values
PROBLEM SOLVED - EXPLANATION BELOW.
I'm working on a graphing function which calculates the min/max values of the graph. I want to be able to take the min/max and extend them a small degree so that there is a small amount of padding on the left of the min and the right of the max. I want to increase/decrease the date by 10% of the difference of the two dates. So if the dates are separated by 10 days I want to add 1 day to the max and subtract 1 day from the minimum.
This seems like it would be an easy task but I can't seem to get it right.
var max = 1269003636000; var min = 1011020436000; var constant = 0.1; var offSet = Math.abs((max - min)*constant) max += offSet; min -= offset;
What changes should I make to get this to work properly?
It did turn out to be something simple. The var min/max were being read as strings so += was concatenating instead of adding. A simple use of parseInt solved the problem.Follow Me On Twitter: BryceRay