Package org.apache.ws.commons.util

Examples of org.apache.ws.commons.util.XsTimeFormat


     * {@link org.apache.ws.jaxme.xs.util.XsTimeFormat#format(Object, StringBuffer, java.text.FieldPosition)}.
     */
    public void testFormatTime() {
        Calendar cal = getCalendar(TimeZone.getTimeZone("GMT"));
        assertEquals(0, cal.get(Calendar.MILLISECOND));
        XsTimeFormat format = new XsTimeFormat();
        String got = format.format(cal);
        String expect = "03:12:07Z";
        assertEquals(expect, got);

        cal = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
        assertEquals(0, cal.get(Calendar.MILLISECOND));
        got = format.format(cal);
        expect = "03:12:07-03:00";
        assertEquals(expect, got);
    }
View Full Code Here


      "03:12:07.000Z",
      "03:12:07",
      "03:12:07-00:00",
      "03:12:07+00:00",
        };
        XsTimeFormat format = new XsTimeFormat();
        Calendar expect = getCalendar(TimeZone.getTimeZone("GMT"));
        for (int i = 0;  i < dateTimes.length;  i++) {
            Calendar got = (Calendar) format.parseObject(dateTimes[0]);
            assertEqualTime(expect, got);
        }

        String dateTime = "03:12:07.000-03:00";
        expect = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
        Calendar got = (Calendar) format.parseObject(dateTime);
        assertEqualTime(expect, got);
    }
View Full Code Here

        Format format = new XsDateTimeFormat();
        Calendar c1 = (Calendar) format.parseObject("2006-05-03T15:29:17.15Z");
        Calendar c2 = (Calendar) format.parseObject("2006-05-03T15:29:17.150Z");
        assertEquals(c1, c2);

        format = new XsTimeFormat();
        c1 = (Calendar) format.parseObject("15:29:17.15Z");
        c2 = (Calendar) format.parseObject("15:29:17.150Z");
        assertEquals(c1, c2);
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.util.XsTimeFormat

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.