private static long getStartTimeOfPreviousMonth(long currentEmitTime) {
        ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(currentEmitTime),
                ZoneId.of("GMT"));
        int givenMonth = zonedDateTime.getMonthValue();
        int givenYear = zonedDateTime.getYear();

        if (givenMonth == 1) {
            return ZonedDateTime.of(--givenYear, 12, 1, 0, 0, 0, 0, ZoneId.of("GMT"))
                    .toEpochSecond() * 1000;
        } else {
            return ZonedDateTime
                    .of(givenYear, --givenMonth, 1, 0, 0, 0, 0, ZoneId.of("GMT"))
                    .toEpochSecond() * 1000;
        }
    }
Performs time conversions related to incremental aggregation.
modules/siddhi-core/src/main/java/io/siddhi/core/util/IncrementalTimeConverterUtil.java