# Task Duration

## Content



The duration of the task specifies how long the task will take to complete. **GanttView** uses the **DurationUnits** property to specify the units and the **Duration** property to specify the value for units. The **DurationUnit** property of the **Task** class takes **DurationUnit** enumeration as input to set the unit of duration to Minutes, Hours, Days, Weeks, or Months.

Use the below code to set the task duration in the GanttView.

```csharp
//Set duration unit and duration of a task
Task1.DurationUnits= DurationUnits.Days;
Task1.Duration = 4;
```