I want to make a time interval slider with an initial setting of (10:00:00 Mar. 8 2015, 12:30:00 Mar. 8 2015) and which varies from 00:00:00 Mar. 8 2015 to 22:30:00 Mar. 8 2015 with a granularity of 5 Minutes.
I tried using IntervalSlider
in Mathematica 10 like this:
IntervalSlider[{DateString[{2015, 3, 8, 10, 0, 0.}],
DateString[{2015, 3, 8, 12, 30, 0.}]}, {DateObject[{2015, 3, 8, 0,
0, 0.}], DateObject[{2015, 3, 8, 22, 30, 0.}],
Quantity[5, "Minutes"]}]
but it doesn't work. Any ideas?
Answer
You will need work with an interval slider in terms of AbsoluteTime
values because such sliders only work with numeric objects. Here is a demonstration where a interval slider has the behavior you want.
With[{
min0 = AbsoluteTime @ DateObject[{2015, 3, 8, 10, 0, 0.}],
max0 = AbsoluteTime @ DateObject[{2015, 3, 8, 12, 30, 0.}],
minT = AbsoluteTime @ DateObject[{2015, 3, 8, 0, 0, 0.}],
maxT = AbsoluteTime @ DateObject[{2015, 3, 8, 22, 30, 0.}]},
Manipulate[
DateString /@ span,
{{span, {min0, max0}, "Interval"}, minT, maxT, 5 60,
ControlType -> IntervalSlider}]]
Comments
Post a Comment