Examples of XsDateTimeFormat


Examples of org.apache.ws.jaxme.xs.util.XsDateTimeFormat

    }

    /** Tests, whether e zero as suffix matters in milliseconds.
     */
    public void testZeroSuffix() throws Exception {
        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

Examples of org.apache.ws.jaxme.xs.util.XsDateTimeFormat

    }

    public void testFormatDateTime() {
        Calendar cal = getCalendar(TimeZone.getTimeZone("GMT"));
        assertEquals(0, cal.get(Calendar.MILLISECOND));
        XsDateTimeFormat format = new XsDateTimeFormat();
        String got = format.format(cal);
        String expect = "2004-01-14T03:12:07Z";
        assertEquals(expect, got);

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

Examples of org.apache.ws.jaxme.xs.util.XsDateTimeFormat

      "2004-01-14T03:12:07.000Z",
      "2004-01-14T03:12:07",
      "2004-01-14T03:12:07-00:00",
      "2004-01-14T03:12:07+00:00",
    };
        XsDateTimeFormat format = new XsDateTimeFormat();
        Calendar expect = getCalendar(TimeZone.getTimeZone("GMT"));
        for (int i = 0;  i < dateTimes.length;  i++) {
            Calendar got = (Calendar) format.parseObject(dateTimes[0]);
            assertEquals(expect.getTimeInMillis(), got.getTimeInMillis());
        }

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

Examples of org.apache.ws.jaxme.xs.util.XsDateTimeFormat

   *   instance of {@link org.apache.ws.jaxme.xs.util.XsDateTimeFormat}
   *   (default).
   */
public Format getDateTimeFormat() {
      if (dateTimeFormat == null) {
          dateTimeFormat = new XsDateTimeFormat();
      }
      return dateTimeFormat;
  }
View Full Code Here

Examples of org.apache.ws.jaxme.xs.util.XsDateTimeFormat

        }
        return new QName(uri, localName);
    }

    public Calendar parseDateTime(String arg0) {
        XsDateTimeFormat format = new XsDateTimeFormat();
        ParsePosition pos = new ParsePosition(0);
        Calendar cal = (Calendar) format.parseObject(arg0, pos);
        if (cal == null) {
            throw new IllegalArgumentException("Failed to parse dateTime " + arg0 +
                                   " at:" + arg0.substring(pos.getErrorIndex()));
        }
        return cal;
View Full Code Here

Examples of org.apache.ws.jaxme.xs.util.XsDateTimeFormat

            return prefix + ":" + arg0.getLocalPart();
        }
    }

    public String printDateTime(Calendar arg0) {
        return new XsDateTimeFormat().format(arg0);
    }
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.