Package javax.time.calendar.zone

Examples of javax.time.calendar.zone.ZoneRules


     * @throws CalendricalException if the result exceeds the supported range
     */
    public static ZonedDateTime fromInstant(OffsetDateTime dateTime, TimeZone zone) {
        ISOChronology.checkNotNull(dateTime, "OffsetDateTime must not be null");
        ISOChronology.checkNotNull(zone, "TimeZone must not be null");
        ZoneRules rules = zone.getRules()// latest rules version
        if (rules.isValidDateTime(dateTime) == false) {
            ZoneOffset offsetForInstant = rules.getOffset(dateTime);
            dateTime = dateTime.withOffsetSameInstant(offsetForInstant);
        }
        return new ZonedDateTime(dateTime, zone);
    }
View Full Code Here


            String versionID = "";
            if (pos >= 0) {
                versionID = zoneID.substring(pos + 1);
                zoneID = zoneID.substring(0, pos);
            }
            ZoneRules rules = group.getRules(zoneID, versionID)// validates IDs
            return new TimeZone(group.getID(), zoneID, versionID, rules);
        }
    }
View Full Code Here

        ISOChronology.checkNotNull(offset, "ZoneOffset must not be null");
        if (offset == ZoneOffset.UTC) {
            return UTC;
        }
        String id = "UTC" + offset.getID();
        ZoneRules zoneRules = ZoneRules.fixed(offset);
        return new TimeZone("", id, "", zoneRules);
    }
View Full Code Here

            if (versionID.length() > 0) {
                throw new CalendricalException("Fixed time zone does not provide versions");
            }
            return this;
        }
        ZoneRules rules = getGroup().getRules(regionID, versionID)// validates IDs
        if (versionID.equals(this.versionID)) {
            return this;
        }
        return new TimeZone(groupID, regionID, versionID, rules);
    }
View Full Code Here

        // fixed rules always in transient field
        if (rules != null) {
            return rules;
        }
        ZoneRulesGroup group = ZoneRulesGroup.getGroup(groupID);
        ZoneRules r = group.getRules(regionID, versionID);
        if (versionID.length() > 0) {
            rules = r;
        }
        return r;
    }
View Full Code Here

TOP

Related Classes of javax.time.calendar.zone.ZoneRules

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.