API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

account_GetEntriesByDate

0
Hi economic support

The following code snippet does not seem to return elements for the 1st day in the month. Is that on purpose?

ArrayOfEntryHandle entries = eSession.account_GetEntriesByDate(accountHandle, getFirstDayOfMonth(year, month), getLastDayOfMonth(year, month));

========

    private static Calendar getLastDayOfMonth(int year, int month) {
        Calendar calCurr = getFirstDayOfMonth(year, month);
        calCurr.set(Calendar.DAY_OF_MONTH,calCurr.getActualMaximum(Calendar.DAY_OF_MONTH));
        return calCurr;
    }

    private static Calendar getFirstDayOfMonth(int year, int month) {
        Calendar calCurr = GregorianCalendar.getInstance();
        calCurr.set(year,month,calCurr.getActualMinimum(Calendar.DAY_OF_MONTH));
        return calCurr;
    }

==========

Best Regards
Jan Riis
created Nov 2, 2011 by janriis
0% Accept Rate
Q 1 A 4 C 2

1 Answer

0
OK ... found the problem. The API is not only filtering on the date part of the Calendar but also on the time part. This works:

=========
    private static Calendar getLastDayOfMonth(int year, int month) {
        Calendar calCurr = getFirstDayOfMonth(year, month);
        calCurr.set(year,month,calCurr.getActualMaximum(Calendar.DAY_OF_MONTH),23,59,59);
        return calCurr;
    }

    private static Calendar getFirstDayOfMonth(int year, int month) {
        Calendar calCurr = GregorianCalendar.getInstance();
        calCurr.set(year,month,calCurr.getActualMinimum(Calendar.DAY_OF_MONTH),0,0,0);
        return calCurr;
    }
=========
answered Nov 2, 2011 by janriis
Visma e-conomic A/S
...