Package org.joda.time.chrono

Examples of org.joda.time.chrono.ISOChronology$Stub


        loadAndCompare(test, "CopticChronology", true);
        inlineCompare(test, true);
    }

    public void testSerializedISOChronology() throws Exception {
        ISOChronology test = ISOChronology.getInstance(PARIS);
        loadAndCompare(test, "ISOChronology", true);
        inlineCompare(test, true);
    }
View Full Code Here


    }

    //-----------------------------------------------------------------------
    public void testToString() {
        DateTimeZone paris = DateTimeZone.forID("Europe/Paris");
        ISOChronology isoParis = ISOChronology.getInstance(paris);
       
        assertEquals("ISOChronology[Europe/Paris]", isoParis.toString());
        assertEquals("GJChronology[Europe/Paris]", GJChronology.getInstance(paris).toString());
        assertEquals("GregorianChronology[Europe/Paris]", GregorianChronology.getInstance(paris).toString());
        assertEquals("JulianChronology[Europe/Paris]", JulianChronology.getInstance(paris).toString());
        assertEquals("BuddhistChronology[Europe/Paris]", BuddhistChronology.getInstance(paris).toString());
        assertEquals("CopticChronology[Europe/Paris]", CopticChronology.getInstance(paris).toString());
View Full Code Here

        loadAndCompare(test, "CopticChronology", true);
        inlineCompare(test, true);
    }

    public void testSerializedISOChronology() throws Exception {
        ISOChronology test = ISOChronology.getInstance(PARIS);
        loadAndCompare(test, "ISOChronology", true);
        inlineCompare(test, true);
    }
View Full Code Here

    @Description("add the specified amount of time to the given time")
    @ScalarFunction("date_add")
    @SqlType(TimeType.class)
    public static long addFieldValueTime(ConnectorSession session, @SqlType(VarcharType.class) Slice unit, @SqlType(BigintType.class) long value, @SqlType(TimeType.class) long time)
    {
        ISOChronology chronology = getChronology(session.getTimeZoneKey());
        return modulo24Hour(chronology, getTimeField(chronology, unit).add(time, Ints.checkedCast(value)));
    }
View Full Code Here

    public static long addFieldValueTimeWithTimeZone(
            @SqlType(VarcharType.class) Slice unit,
            @SqlType(BigintType.class) long value,
            @SqlType(TimeWithTimeZoneType.class) long timeWithTimeZone)
    {
        ISOChronology chronology = unpackChronology(timeWithTimeZone);
        long millis = modulo24Hour(chronology, getTimeField(chronology, unit).add(unpackMillisUtc(timeWithTimeZone), Ints.checkedCast(value)));
        return updateMillisUtc(millis, timeWithTimeZone);
    }
View Full Code Here

    @Description("difference of the given times in the given unit")
    @ScalarFunction("date_diff")
    @SqlType(BigintType.class)
    public static long diffTime(ConnectorSession session, @SqlType(VarcharType.class) Slice unit, @SqlType(TimeType.class) long time1, @SqlType(TimeType.class) long time2)
    {
        ISOChronology chronology = getChronology(session.getTimeZoneKey());
        return getTimeField(chronology, unit).getDifference(time2, time1);
    }
View Full Code Here

    @ScalarOperator(CAST)
    @SqlType(DateType.class)
    public static long castToDate(ConnectorSession session, @SqlType(TimestampType.class) long value)
    {
        // round down the current timestamp to days
        ISOChronology chronology = getChronology(session.getTimeZoneKey());
        long date = chronology.dayOfYear().roundFloor(value);
        // date is currently midnight in timezone of the session
        // convert to UTC
        return date + chronology.getZone().getOffset(date);
    }
View Full Code Here

    @SqlType(TimestampType.class)
    public static long castToTimestamp(ConnectorSession session, @SqlType(DateType.class) long value)
    {
        // date is encoded as milliseconds at midnight in UTC
        // convert to midnight if the session timezone
        ISOChronology chronology = getChronology(session.getTimeZoneKey());
        return value - chronology.getZone().getOffset(value);
    }
View Full Code Here

    @SqlType(TimestampWithTimeZoneType.class)
    public static long castToTimestampWithTimeZone(ConnectorSession session, @SqlType(DateType.class) long value)
    {
        // date is encoded as milliseconds at midnight in UTC
        // convert to midnight if the session timezone
        ISOChronology chronology = getChronology(session.getTimeZoneKey());
        long millis = value - chronology.getZone().getOffset(value);
        return packDateTimeWithZone(millis, session.getTimeZoneKey());
    }
View Full Code Here

    @Description("add the specified amount of time to the given time")
    @ScalarFunction("date_add")
    @SqlType(TimeType.class)
    public static long addFieldValueTime(ConnectorSession session, @SqlType(VarcharType.class) Slice unit, @SqlType(BigintType.class) long value, @SqlType(TimeType.class) long time)
    {
        ISOChronology chronology = getChronology(session.getTimeZoneKey());
        return modulo24Hour(chronology, getTimeField(chronology, unit).add(time, Ints.checkedCast(value)));
    }
View Full Code Here

TOP

Related Classes of org.joda.time.chrono.ISOChronology$Stub

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.