Working Time Range

In Gantt control, working hours in a day for a project can be defined by using the DayWorkingTime property. Based on the working hours, automatic date scheduling and duration validations for a task are performed.

The below code snippet explains on how to define the working time range for the project in Gantt,

  • html
  • <ej:Gantt ID="GanttContainer" ClientIDMode="Static" runat="server" //..>
        <DayWorkingTime>
            <ej:GanttDayWorkingTime From="08:00 AM" To="12:00 PM" />
            <ej:GanttDayWorkingTime From="01:00 PM" To="05:00 PM" />
        </DayWorkingTime>
    </ej:Gantt>

    NOTE

    1. Individual tasks can lie between any time within the defined working time range of the project.

    NOTE

    1. DayWorkingTime property is used to define the working time for the whole project.

    The below demo explains the working time range in Gantt.

    Working Time Range

    The following screen shot shows working time range in Gantt control.

    Highlight working time range

    Highlight the working time range with a background color by using the DayWorkingTime.Background property. You can highlight the non-working time ranges in a day. To do this, set the HighlightNonWorkingTime property to true. To customize the non-working time background, use the NonWorkingBackground property.

    The following code snippet explains how to define the working time range with background in Gantt.

  • html
  • <ej:Gantt ID="GanttContainer" ClientIDMode="Static" runat="server" HighlightNonWorkingTime="true" NonWorkingBackground="#B7C3D0">
        <DayWorkingTime>
            <ej:GanttDayWorkingTime From="08:00 AM" To="12:00 PM" Background="#EBF5FB" />
            <ej:GanttDayWorkingTime From="01:00 PM" To="05:00 PM" Background="#EBF5FB" />
        </DayWorkingTime>
    </ej:Gantt>

    NOTE

    The background colors of working time range are highlighted only when the ScheduleHeaderSettings.ScheduleHeaderType value as day.

    The following screenshot shows the working time range with background colors.