Package org.joda.time

Examples of org.joda.time.DateTimeFieldType$StandardDateTimeFieldType


     */
    public static RangeDivisionInfo getRangeDivisionInfo(Interval timeRange) {
        //Check from largest to smallest unit

        //TODO: make this more generic... reduce code duplication -jm
        DateTimeFieldType timeUnit;
        final DateTime startWithZone = timeRange.getStart().withZone(TimeLineController.getJodaTimeZone());
        final DateTime endWithZone = timeRange.getEnd().withZone(TimeLineController.getJodaTimeZone());

        if (Years.yearsIn(timeRange).isGreaterThan(Years.THREE)) {
            timeUnit = DateTimeFieldType.year();
            long lower = startWithZone.property(timeUnit).roundFloorCopy().getMillis();
            long upper = endWithZone.property(timeUnit).roundCeilingCopy().getMillis();
            return new RangeDivisionInfo(timeRange, Years.yearsIn(timeRange).get(timeUnit.getDurationType()) + 1, TimeUnits.YEARS, ISODateTimeFormat.year(), lower, upper);
        } else if (Months.monthsIn(timeRange).isGreaterThan(Months.THREE)) {
            timeUnit = DateTimeFieldType.monthOfYear();
            long lower = startWithZone.property(timeUnit).roundFloorCopy().getMillis();
            long upper = endWithZone.property(timeUnit).roundCeilingCopy().getMillis();
            return new RangeDivisionInfo(timeRange, Months.monthsIn(timeRange).getMonths() + 1, TimeUnits.MONTHS, DateTimeFormat.forPattern("YYYY'-'MMMM"), lower, upper);
View Full Code Here

TOP

Related Classes of org.joda.time.DateTimeFieldType$StandardDateTimeFieldType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.