Examples of ISOChronology


Examples of org.joda.time.chrono.ISOChronology

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

Examples of org.joda.time.chrono.ISOChronology

    public static long addFieldValueTimeWithTimeZone(
            @SqlType(StandardTypes.VARCHAR) Slice unit,
            @SqlType(StandardTypes.BIGINT) long value,
            @SqlType(StandardTypes.TIME_WITH_TIME_ZONE) 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

Examples of org.joda.time.chrono.ISOChronology

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

Examples of org.joda.time.chrono.ISOChronology

    @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

Examples of org.joda.time.chrono.ISOChronology

    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

Examples of org.joda.time.chrono.ISOChronology

    @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

Examples of org.joda.time.chrono.ISOChronology

    @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

Examples of org.joda.time.chrono.ISOChronology

    @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

Examples of org.joda.time.chrono.ISOChronology

    @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

Examples of org.joda.time.chrono.ISOChronology

    @ScalarOperator(CAST)
    @SqlType(DateType.class)
    public static long castToDate(@SqlType(TimestampWithTimeZoneType.class) long value)
    {
        // round down the current timestamp to days
        ISOChronology chronology = unpackChronology(value);
        long date = chronology.dayOfYear().roundFloor(unpackMillisUtc(value));
        // date is currently midnight in timezone of the original value
        // convert to UTC
        return date + chronology.getZone().getOffset(date);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.