Calculate Task Duration in Different Units in Ruby

Aspose.Tasks - Calculate Task Duration in Different Units

To Calculate Task Duration in Different Units using Aspose.Tasks Java for Ruby, simply invoke CalculateTaskDuration module. Here you can see example code.

Ruby Code

 1project = Rjb::import('com.aspose.tasks.Project').new('test_tasks.mpp')
 2
 3tsk = Rjb::import('com.aspose.tasks.Tsk')
 4
 5time_unit_type = Rjb::import('com.aspose.tasks.TimeUnitType')
 6
 7task = project.getRootTask().getChildren().getById(1)
 8
 9puts task.get(tsk.DURATION).convert(time_unit_type.Minute).toDouble()
10
11puts task.get(tsk.DURATION).convert(time_unit_type.Day).toDouble()
12
13puts task.get(tsk.DURATION).convert(time_unit_type.Hour).toDouble()
14
15puts task.get(tsk.DURATION).convert(time_unit_type.Week).toDouble()
16
17puts task.get(tsk.DURATION).convert(time_unit_type.Month).toDouble()

Download Running Code

Download Calculate Task Duration in Different Units (Aspose.Tasks) from any of the below mentioned social coding sites:

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.