Package com.skaringa.util

Examples of com.skaringa.util.ISO8601DateTimeFormat.format()


    TimeZone tz = TimeZone.getTimeZone("GMT+01");
    Calendar cal = Calendar.getInstance(tz);
    cal.set(1962, Calendar.JANUARY, 19, 8, 40, 0);
    ISO8601DateTimeFormat formatter = new ISO8601DateTimeFormat(tz);

    String res = formatter.format(cal.getTime());

    assertEquals(
      "ISO 8601 date formatter produces wrong output",
      "1962-01-19T08:40:00+01:00",
      res);
View Full Code Here


   */
  public void testFormatAndParse() {
    Calendar cal = new GregorianCalendar(1962, 0, 19, 8, 40);
    Date myBirthDay = cal.getTime();
    ISO8601DateTimeFormat formatter = new ISO8601DateTimeFormat();
    String serial = formatter.format(myBirthDay);

    ParsePosition pos = new ParsePosition(0);
    Date parsedDate = formatter.parse(serial, pos);
    assertNotNull(
      "Parsing of " + serial + " failed at position " + pos.getIndex(),
View Full Code Here

    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00"));
    cal.set(2000, 0, 1, 0, 0, 0);
    Date gmt = cal.getTime();
    ISO8601DateTimeFormat formatter =
      new ISO8601DateTimeFormat(TimeZone.getTimeZone("GMT+00"));
    String gmtStr = formatter.format(gmt);
    assertEquals(
      "ISO 8601 date handling of timezones failed.",
      "2000-01-01T00:00:00Z",
      gmtStr);
View Full Code Here

      gmtStr);

    ISO8601DateTimeFormat parser =
      new ISO8601DateTimeFormat(TimeZone.getTimeZone("GMT+01"));
    Date met = parser.parse(gmtStr);
    String metStr = parser.format(met);

    assertEquals(
      "ISO 8601 date handling of timezones failed.",
      "2000-01-01T01:00:00+01:00",
      metStr);
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.