Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to customize the time slider. Currently I am using "esriTimeUnitsMonths" in which I am getting only months not the year (Please check the imagescreenshot)

I want to put month name +year ex. Jan 09 Feb 09 like that..

I researched on google but I am not able find suitable information. Some one told me that create the array but we can use array on time slider.

Any help will be great..thanks in advance : )

Software : ArcGIS Server 10.1 & ArcGIS Java Script API 3.1

Code: `

var timeExtent = new esri.TimeExtent();
        timeExtent.startTime = new Date("1/1/2009 UTC");
        timeExtent.endTime = new Date("12/31/2011 UTC");
        // original timeSlider.createTimeStopsByTimeInterval(timeExtent,1,'esriTimeUnitsMonths');
       // timeSlider.timeStops(3);
share|improve this question
up vote 4 down vote accepted

Generate your own array of labels, and then specify them on the time slider using TimeSlider.setLabels.

Here's code I put together to do this, use this after you've called timeSlider.startup():

var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
//add labels for every other time stop
var labels =, function(timeStop,i){ 
  if ( i % 2 ) {
    var m = months[timeStop.getMonth()];
    var y = (timeStop.getFullYear() - 2000);
    var py = (y < 10) ? "0" + y : y;
    var lbl =  m + " " + py;
    console.log("time stop: ", lbl);
    return lbl;
  } else {
    return "";


The code above will label every other tick instead of every tick. Labeling every tick clutters up the bottom of the slider and makes all labels hard to read. This technique is also shown in the Time Slider sample.

share|improve this answer
Hello Derek, Thanks for your answer..I will try this and let you know..thanks once again : ) – Sunil Nov 2 '12 at 19:00
Thank you very much...still getting an error but I will find out almost resolved..thanks once again : ) – Sunil Nov 3 '12 at 11:03
@Derek..Its done: ) ..thanks – Sunil Nov 3 '12 at 11:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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