Examples of withHourOfDay()


Examples of org.joda.time.DateTime.withHourOfDay()

        } else {
            p &= ~(1<<31);
            dt = dt.withYear(((p >>> 14) & 0xFFFF) + 1900);
            dt = dt.withMonthOfYear(((p >>> 10) & 0xF) + 1);
            dt = dt.withDayOfMonth(((p >>> 5& 0x1F));
            dt = dt.withHourOfDay((p & 0x1F));
            dt = dt.withMinuteOfHour(((s >>> 26) & 0x3F));
            dt = dt.withSecondOfMinute(((s >>> 20) & 0x3F));
            // marsaling dumps usec, not msec
            dt = dt.withMillisOfSecond((s & 0xFFFFF) / 1000);
            dt = dt.withZone(getLocalTimeZone(runtime));
View Full Code Here

Examples of org.joda.time.DateTime.withHourOfDay()

    //-----------------------------------------------------------------------
    public void test_setHourOfDay() {
        Chronology zone = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
        DateTime dt = new DateTime(2007, 1, 1, 0, 0 ,0, 0, zone);
        assertEquals("2007-01-01T00:00:00.000Z", dt.toString());
        dt = dt.withHourOfDay(24);
        assertEquals("2007-01-02T00:00:00.000Z", dt.toString());
        dt = dt.withHourOfDay(-1);
        assertEquals("2007-01-01T23:00:00.000Z", dt.toString());
    }
View Full Code Here

Examples of org.joda.time.DateTime.withHourOfDay()

        Chronology zone = LenientChronology.getInstance(ISOChronology.getInstanceUTC());
        DateTime dt = new DateTime(2007, 1, 1, 0, 0 ,0, 0, zone);
        assertEquals("2007-01-01T00:00:00.000Z", dt.toString());
        dt = dt.withHourOfDay(24);
        assertEquals("2007-01-02T00:00:00.000Z", dt.toString());
        dt = dt.withHourOfDay(-1);
        assertEquals("2007-01-01T23:00:00.000Z", dt.toString());
    }

    //-----------------------------------------------------------------------
    //------------------------ Bug ------------------------------------------
View Full Code Here

Examples of org.joda.time.DateTime.withHourOfDay()

            if (hour == "24") {
                adjustedHour = "00";
                dateTime = dateTime.plusDays(1);
            }

            dateTime = dateTime.withHourOfDay(Integer.valueOf(adjustedHour)).withZoneRetainFields(
                    DateTimeZone.forID(timeZoneOffset));
            result = isoFormat.print(dateTime);
        }
        return result;
    }
View Full Code Here

Examples of org.joda.time.DateTime.withHourOfDay()

     *            an interval label (05, 10, 15, ...)
     * @return a minute interval from the start of the hour
     */
    public static String getIntervalEndingInIso(final String day, final String hour, final String intervalLabel) {
        DateTime dateTime = isoToDateTime(day);
        dateTime = dateTime.withHourOfDay(Integer.parseInt(hour) - 1).plusMinutes(Integer.parseInt(intervalLabel));
        return dateTimeToIsoNoMillis(dateTime);
    }

    /**
     * Determine if an interval based on an ISO8601 formatted String is a valid 5 minute interval
View Full Code Here

Examples of org.joda.time.DateTime.withHourOfDay()

            p &= ~(1<<31);
            utc = ((p >>> 30 & 0x1) == 0x1);
            dt = dt.withYear(((p >>> 14) & 0xFFFF) + 1900);
            dt = dt.withMonthOfYear(((p >>> 10) & 0xF) + 1);
            dt = dt.withDayOfMonth(((p >>> 5& 0x1F));
            dt = dt.withHourOfDay((p & 0x1F));
            dt = dt.withMinuteOfHour(((s >>> 26) & 0x3F));
            dt = dt.withSecondOfMinute(((s >>> 20) & 0x3F));
            // marsaling dumps usec, not msec
            dt = dt.withMillisOfSecond((s & 0xFFFFF) / 1000);
            time.setUSec((s & 0xFFFFF) % 1000);
View Full Code Here

Examples of org.joda.time.DateTime.withHourOfDay()

        assertFunction("date_trunc('minute', " + TIMESTAMP_LITERAL + ")", toTimestamp(result));

        result = result.withMinuteOfHour(0);
        assertFunction("date_trunc('hour', " + TIMESTAMP_LITERAL + ")", toTimestamp(result));

        result = result.withHourOfDay(0);
        assertFunction("date_trunc('day', " + TIMESTAMP_LITERAL + ")", toTimestamp(result));

        result = result.withDayOfMonth(20);
        assertFunction("date_trunc('week', " + TIMESTAMP_LITERAL + ")", toTimestamp(result));
View Full Code Here

Examples of org.joda.time.DateTime.withHourOfDay()

        assertFunction("date_trunc('minute', " + WEIRD_TIMESTAMP_LITERAL + ")", toTimestampWithTimeZone(result));

        result = result.withMinuteOfHour(0);
        assertFunction("date_trunc('hour', " + WEIRD_TIMESTAMP_LITERAL + ")", toTimestampWithTimeZone(result));

        result = result.withHourOfDay(0);
        assertFunction("date_trunc('day', " + WEIRD_TIMESTAMP_LITERAL + ")", toTimestampWithTimeZone(result));

        result = result.withDayOfMonth(20);
        assertFunction("date_trunc('week', " + WEIRD_TIMESTAMP_LITERAL + ")", toTimestampWithTimeZone(result));
View Full Code Here

Examples of org.joda.time.DateTime.withHourOfDay()

            p &= ~(1<<31);
            utc = ((p >>> 30 & 0x1) == 0x1);
            dt = dt.withYear(((p >>> 14) & 0xFFFF) + 1900);
            dt = dt.withMonthOfYear(((p >>> 10) & 0xF) + 1);
            dt = dt.withDayOfMonth(((p >>> 5& 0x1F));
            dt = dt.withHourOfDay((p & 0x1F));
            dt = dt.withMinuteOfHour(((s >>> 26) & 0x3F));
            dt = dt.withSecondOfMinute(((s >>> 20) & 0x3F));
            // marsaling dumps usec, not msec
            dt = dt.withMillisOfSecond((s & 0xFFFFF) / 1000);
            time.setUSec((s & 0xFFFFF) % 1000);
View Full Code Here

Examples of org.joda.time.DateTime.withHourOfDay()

    Query allRowsQuery = new QueryBuilder("select * from vtgate_test", testEnv.keyspace, "master")
        .setKeyspaceIds(testEnv.getAllKeyspaceIds()).build();
    Row row = vtgate.execute(allRowsQuery).next();
    Assert.assertTrue(dt.equals(row.getDateTime("timestamp_col")));
    Assert.assertTrue(dt.equals(row.getDateTime("datetime_col")));
    Assert.assertTrue(dt.withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0)
        .equals(row.getDateTime("date_col")));
    Assert.assertTrue(
        dt.withYear(1970).withMonthOfYear(1).withDayOfMonth(1).equals(row.getDateTime("time_col")));

    vtgate.close();
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.