Search code examples
jquerydhtmlx-scheduler

Setting Dhtmlx Scheduler Timeline View hour header to 12-hour format


In Dhtmlx Scheduler Timeline View, how can I set the Hour header from military time(24hour) to 12-hour format?

Timeline View, Hour header

I have found some responses on their forum but this doesnt seem to work.

scheduler.config.hour_date = "%h:%i %A";

Any help would be appreciated. Thanks!


Solution

  • Hour format must be specified in timeline configuration object with x_date property. Here is the example:

    scheduler.createTimelineView({
        name:   "timeline",
        x_unit: "hour",
        x_date: "%h:%i %A",
        x_step: 1,
        x_size: 24,
        y_unit: [
            {key:1, label:"James Smith"},
            {key:2, label:"John Williams"},
            {key:3, label:"David Miller"},
            {key:4, label:"Linda Brown"}
        ],
        y_property: "section_id",
        render:"bar"
    });