APISonar


name.abuchen.portfolio.util.Dates.date

> name > abuchen > portfolio > util > Dates > date
name APIs abuchen APIs portfolio APIs util APIs Dates APIs date APIs

Example 1
public void testLeapYear()
    {
        Date d1 = Dates.date(2008, Calendar.FEBRUARY, 28);
        Date d2 = Dates.date(2008, Calendar.MARCH, 1);
        assertThat(Dates.daysBetween(d1, d2), is(2));
    }
Example 2
public void testSimple()
    {
        Calendar cal = Calendar.getInstance();
        cal.set(2010, 0, 1);
        cal.getTime();

        NPVFunction f = new NPVFunction(Arrays.asList( //
                        Dates.date(2010, Calendar.JANUARY, 1), //
                        Dates.date(2010, Calendar.DECEMBER, 31)), //
                        Arrays.asList(-200d, 210d));

        assertThat(f.compute(0.05d), is(3965.669635841685d));
    }