org.joda.time.DateTimeConstants#APRIL源码实例Demo

下面列出了org.joda.time.DateTimeConstants#APRIL 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
protected int monthOfYear(int periodNumber) {
    switch (periodNumber) {
        case 1:
            return DateTimeConstants.JANUARY;
        case 2:
            return DateTimeConstants.APRIL;
        case 3:
            return DateTimeConstants.JULY;
        case 4:
            return DateTimeConstants.OCTOBER;
        default:
            return DateTimeConstants.JANUARY;

    }
}
 
@Override
protected int monthOfYear(int period) {
    if (period == 1) {
        return DateTimeConstants.APRIL;
    } else {
        return DateTimeConstants.OCTOBER;
    }
}
 
private int getPreviousPeriodStart() {
    int nowMonthOfYear = new LocalDate().getMonthOfYear();
    if (nowMonthOfYear >= DateTimeConstants.OCTOBER) {
        return PREVIOUS_PERIOD_START_OCTOBER;
    } else if (nowMonthOfYear >= DateTimeConstants.JULY) {
        return PREVIOUS_PERIOD_START_JULY;
    } else if (nowMonthOfYear >= DateTimeConstants.APRIL) {
        return PREVIOUS_PERIOD_START_APRIL;
    } else {
        return PREVIOUS_PERIOD_START_JANUARY;
    }
}
 
private int monthStart(int previousPeriod) {
    switch (previousPeriod) {
        case PREVIOUS_PERIOD_START_JANUARY:
            return DateTimeConstants.JANUARY;
        case PREVIOUS_PERIOD_START_APRIL:
            return DateTimeConstants.APRIL;
        case PREVIOUS_PERIOD_START_JULY:
            return DateTimeConstants.JULY;
        case PREVIOUS_PERIOD_START_OCTOBER:
            return DateTimeConstants.OCTOBER;
        default:
            return DateTimeConstants.JANUARY;
    }
}
 
protected int monthOfYear() {
    return DateTimeConstants.APRIL;
}