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')
2tsk = Rjb::import('com.aspose.tasks.Tsk')
3time_unit_type = Rjb::import('com.aspose.tasks.TimeUnitType')
4task = project.getRootTask().getChildren().getById(1)
5puts task.get(tsk.DURATION).convert(time_unit_type.Minute).toDouble()
6puts task.get(tsk.DURATION).convert(time_unit_type.Day).toDouble()
7puts task.get(tsk.DURATION).convert(time_unit_type.Hour).toDouble()
8puts task.get(tsk.DURATION).convert(time_unit_type.Week).toDouble()
9puts 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.