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}],


but it doesn't work! Any idea?

  • $\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$ – Gordon Coale Mar 31 '15 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 Mar 31 '15 at 15:16

It could be as simple as this:

 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.

| improve this answer | |
  • $\begingroup$ It works! Thanks a lot! $\endgroup$ – hptru64 Mar 31 '15 at 15:40

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}];
  DateList[basetime + millis],
{millis, 0, max, 300000}]
| improve this answer | |
  • $\begingroup$ There's at least one typo in there. $\endgroup$ – Gordon Coale Mar 31 '15 at 15:25
  • $\begingroup$ Is there? I can't see any but I'm also from mobile right now $\endgroup$ – Braains Mar 31 '15 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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