DateLibrary { public static Date getIso8601StringAsTime(String value) throws ParseException { return getIso8601StringAsTime(value, TimeZone.getDefault()); }  static String getTimeAsIso8601String(Date date); static String getTimeAsIso8601String(Date date, TimeZone timeZone); static Date getIso8601StringAsTime(String value); static Date getIso8601StringAsTime(String value, TimeZone timeZone); static Date getTimeAsDay(Date t); static Date getTimeAsDay(long t); static boolean hasAmPmClock(Locale locale);  }
@Test public void testGetIso8601StringAsTime() throws ParseException { DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); Date expected = format.parse("2010-01-10 11:24:36 PST"); TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles"); Date actual = DateLibrary.getIso8601StringAsTime( "2010-01-10T11:24:36-08:00", tz); assertEquals(expected, actual); }