Hi,
Please run the code as below:
private static SimpleDateFormat formatter2 = new SimpleDateFormat("MM/dd/yy hh:mm:ss");
public static void main(String[] args) throws ParseException {
FileInputStream fstream = null;
try {
// Create a stream object containing the license file
fstream = new FileInputStream("Aspose.Tasks.lic");
// Instantiate the License class
License license = new License();
// Set the license through the stream object
license.setLicense(fstream);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
fstream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
testActualStart();
}
private static void testActualStart() throws ParseException {
Project asProject = new Project("Empty_Project.mpp");
asProject.setCalculationMode(CalculationMode.Automatic);
Task task1 = asProject.getRootTask().getChildren().add("8 hours work");
task1.set(Tsk.START, formatter2.parse("1/3/05 08:00:00"));
task1.set(Tsk.DURATION, asProject.getDuration(1, TimeUnitType.Day));
Resource dwang = asProject.getResources().add("dwang");
ResourceAssignment raDwang = asProject.getResourceAssignments().add(task1, dwang);
raDwang.set(Asn.START, formatter2.parse("1/3/05 08:00:00"));
raDwang.set(Asn.WORK, asProject.getDuration(8, TimeUnitType.Hour));
raDwang.set(Asn.PERCENT_WORK_COMPLETE, 50);
raDwang.set(Asn.ACTUAL_START, formatter2.parse("1/5/05 08:00:00"));
asProject.recalculate();
// Save the Project
asProject.save("output_test_aspose_date.mpp", SaveFileFormat.MPP);
System.out.println("ok");
}
I have some questions as below:
1. Why the Actual Start is "1/03/05"? (I have set the value of actual start "1/5/05" on resource assignment)
raDwang.set(Asn.ACTUAL_START, formatter2.parse("1/5/05 08:00:00"));
2. Why the "%Complete" is 200%?
3. Why the "Actual Duration" is 2days?
Best Regards!
zhencheng.guo