Package org.joda.time

Examples of org.joda.time.LocalTime


     */
    public static LocalTime deserializeLocalTime(String text) throws JiBXException {
        if (text == null) {
            return null;
        } else {
            return new LocalTime(Utility.parseTimeNoOffset(text, 0, text.length()), DateTimeZone.UTC);
        }
    }
View Full Code Here


        assertEquals("2008-03-01Z", JodaConvert.serializeUTCDateMidnight(new DateMidnight(2008, 3, 1, DateTimeZone.UTC)));
    }
   
    public void testDeserializeLocalTime() throws JiBXException {
        assertNull("Null input", JodaConvert.deserializeLocalTime(null));
        LocalTime time = JodaConvert.deserializeLocalTime("01:02:03Z");
        assertEquals("Wrong value", 1, time.getHourOfDay());
        assertEquals("Wrong value", 2, time.getMinuteOfHour());
        assertEquals("Wrong value", 3, time.getSecondOfMinute());
        time = JodaConvert.deserializeLocalTime("02:05:06.123-02:00");
        assertEquals("Wrong value", 2, time.getHourOfDay());
        assertEquals("Wrong value", 5, time.getMinuteOfHour());
        assertEquals("Wrong value", 6, time.getSecondOfMinute());
        assertEquals("Wrong value", 123, time.getMillisOfSecond());
        time = JodaConvert.deserializeLocalTime("02:05:06.123");
        assertEquals("Wrong value", 2, time.getHourOfDay());
        assertEquals("Wrong value", 5, time.getMinuteOfHour());
        assertEquals("Wrong value", 6, time.getSecondOfMinute());
        assertEquals("Wrong value", 123, time.getMillisOfSecond());
        time = JodaConvert.deserializeLocalTime("24:00:00");
        assertEquals("Wrong value", 0, time.getHourOfDay());
        assertEquals("Wrong value", 0, time.getMinuteOfHour());
        assertEquals("Wrong value", 0, time.getSecondOfMinute());
        try {
            JodaConvert.deserializeLocalTime("24:05:06.123-02:00");
            fail("Invalid hour number");
        } catch (JiBXException ex) {}
        try {
View Full Code Here

            fail("Invalid second number");
        } catch (JiBXException ex) {}
    }
   
    public void testSerializeUnzonedLocalTime() throws JiBXException {
        assertEquals("01:02:03", JodaConvert.serializeUnzonedLocalTime(new LocalTime(1, 2, 3)));
        assertEquals("23:59:59", JodaConvert.serializeUnzonedLocalTime(new LocalTime(23, 59, 59)));
        assertEquals("00:00:00.123", JodaConvert.serializeUnzonedLocalTime(new LocalTime(0, 0, 0, 123)));
    }
View Full Code Here

        assertEquals("23:59:59", JodaConvert.serializeUnzonedLocalTime(new LocalTime(23, 59, 59)));
        assertEquals("00:00:00.123", JodaConvert.serializeUnzonedLocalTime(new LocalTime(0, 0, 0, 123)));
    }
   
    public void testSerializeUTCLocalTime() throws JiBXException {
        assertEquals("01:02:03Z", JodaConvert.serializeUTCLocalTime(new LocalTime(1, 2, 3)));
        assertEquals("23:59:59Z", JodaConvert.serializeUTCLocalTime(new LocalTime(23, 59, 59)));
        assertEquals("00:00:00.123Z", JodaConvert.serializeUTCLocalTime(new LocalTime(0, 0, 0, 123)));
    }
View Full Code Here

    protected void setUp() throws Exception {
        weeks = DurationFieldType.weeks();
        months = DurationFieldType.months();
        dateTimeFieldTypeOne = DateTimeFieldType.centuryOfEra();
        localTime = new LocalTime();
    }
View Full Code Here

        assertEquals(new LocalDate(2016, 1, 4, chrono), f.parseLocalDate("2016-01-01"));
    }

    //-----------------------------------------------------------------------
    public void testParseLocalTime_simple() {
        assertEquals(new LocalTime(10, 20, 30), g.parseLocalTime("2004-06-09T10:20:30Z"));
        assertEquals(new LocalTime(10, 20, 30), g.parseLocalTime("2004-06-09T10:20:30+18:00"));
        assertEquals(new LocalTime(10, 20, 30), g.parseLocalTime("2004-06-09T10:20:30-18:00"));
        assertEquals(new LocalTime(10, 20, 30, 0, BUDDHIST_PARIS),
                g.withChronology(BUDDHIST_PARIS).parseLocalTime("2004-06-09T10:20:30Z"));
        try {
            g.parseDateTime("ABC");
            fail();
        } catch (IllegalArgumentException ex) {}
View Full Code Here

    config.getButtonText().setToday("Week");

    config.setLoading("function(bool) { if (bool) $(\"#loading\").show(); else $(\"#loading\").hide(); }");

    config.setMinTime(new LocalTime(6, 30));
    config.setMaxTime(new LocalTime(17, 30));
    config.setAllDaySlot(false);
    FullCalendar calendar = new FullCalendar("cal", config) {
      @Override

      protected void onDateRangeSelected(SelectedRange range,
View Full Code Here

    LocalDate end = new LocalDate();
    LocalDate start = end.minusYears(1);

    List<File> result = new ArrayList<File>();
    IPath[] storagePaths = XmlPlugin.getDefault().getStoragePaths();
    MutableDateTime date = start.toDateTime(new LocalTime(0, 0, 0)).toMutableDateTime();
    while (new LocalDate(date.toInstant().getMillis()).compareTo(end) <= 0) {

      for (IPath path : storagePaths) {
        File f = store.getDataFile(new LocalDate(date.getMillis()), path);
        if (f.exists()) {
View Full Code Here

    Time sqlTime = dataReader.getTime();
    if (sqlTime == null) {
      return null;
    } else {
      return new LocalTime(sqlTime, DateTimeZone.UTC);
    }
  }
View Full Code Here

  }

  @Override
  public LocalTime toBeanType(Object value) {
    if (value instanceof java.util.Date) {
      return new LocalTime(value, DateTimeZone.UTC);
    }
    return (LocalTime) value;
  }
View Full Code Here

TOP

Related Classes of org.joda.time.LocalTime

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.