2
$\begingroup$

I want to make a time slider varied from 12:00:00 Jan 1,2015 to 22:30:00 Jan 1,2015 for every 5 minute.

So like using Manipulate[n,{n,1,20,1}],

Manipulate[tt,{tt,{2015,1,1,12,0,0.},{2015,1,1,22,30,0.},{0,0,0,0,5,0.}}]

but it doesn't work! Any idea?

$\endgroup$
2
  • $\begingroup$ This may give a quick hint Manipulate[ DateObject[date], {date, DateRange[{2015, 1, 1, 12, 0, 0.}, {2015, 1, 1, 22, 30, 0.}, Quantity[5, "Minutes"]]}] You can of course pull most of the code into the manipulate function rather than in the manipulate range specification for date. $\endgroup$ Commented Mar 31, 2015 at 15:03
  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$
    – bbgodfrey
    Commented Mar 31, 2015 at 15:16

2 Answers 2

5
$\begingroup$

It could be as simple as this:

Manipulate[
 DateString[t], {t, DateObject[{2015, 1, 1, 12, 0}], 
  DateObject[{2015, 1, 1, 22, 30}], Quantity[5, "Minutes"]}]

Using DateObjects rather than a List to indicate a date & time seems to work.

$\endgroup$
1
  • $\begingroup$ It works! Thanks a lot! $\endgroup$
    – hptru64
    Commented Mar 31, 2015 at 15:40
0
$\begingroup$

I can't test this right now but I think this will work.

basetime = AbsoluteTime[{2015,1,1,12,0,0}];
max = AbsoluteTime[{2015,1,1,22,30,0}];
Manipulate[
  DateList[basetime + millis],
{millis, 0, max, 300000}]
$\endgroup$
2
  • $\begingroup$ There's at least one typo in there. $\endgroup$ Commented Mar 31, 2015 at 15:25
  • $\begingroup$ Is there? I can't see any but I'm also from mobile right now $\endgroup$
    – Braains
    Commented Mar 31, 2015 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.