Working with Calendar Properties

Microsoft Project use calendars and other information to calculate project end dates. Aspose.Tasks for Java supports the calendar functionality. This article illustrates the calendar properties that can be set and shows how they are applied in code.

Calendar Properties The Calendar exposes several properties used to define the base calendar in Microsoft Outlook:

The code that follows gets the general calendar properties.

 1// The path to the documents directory.
 2String dataDir = Utils.getDataDir(CalendarProperties.class);
 3
 4long OneSec = 10000000;// microsecond * 10
 5long OneMin = 60 * OneSec;
 6long OneHour = 60 * OneMin;
 7
 8Project project = new Project(dataDir + "prj.mpp");
 9
10for (Calendar cal : project.getCalendars()) {
11    if (cal.getName().toString() != null) {
12        for (WeekDay wd : cal.getWeekDays()) {
13            double ts = wd.getWorkingTime();
14            double time = ts / (OneHour);
15            System.out.println("Day Type" + wd.getDayType() + "Hours" + ts);
16        }
17
18        System.out.println("Base Calendar : ");
19        if (cal.isBaseCalendar())
20            System.out.println("Self");
21        else
22            System.out.println(cal.getBaseCalendar().getName());
23
24        System.out.println("UID : " + cal.getUid());
25        System.out.println("Name : " + cal.getName());
26    }
27}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.