DateTimeUtils { static public TimeZone parseTimeZone(String id) throws AdeUsageException { if (id.equals(GMT1) || id.equals(GMT2)) { return TimeZone.getTimeZone(GMT1); } TimeZone res = TimeZone.getTimeZone(id); if (res.equals(TimeZone.getTimeZone(GMT1))) { throw new AdeUsageException("time zone id '" + id + "' is unrecognized."); } return res; } private  DateTimeUtils(); static String timestampToHumanDateAndTimeLocal(long timestamp); static String timestampToHumanDateAndTimeAde(long timestamp); static String timestampToHumanDateAndTimeUTC(long timestamp); static String millisecondsToHumanTime(long period); static String millisecondsToDecimalHumanTime(long period); static long getDayStartTimeLocal(long startTime); static String timestampToHumanDateAndTimeAndStampLocal(long time); static String timestampToHumanDateAndTimeAndStampUTC(long time); static long getTimeStampLocal(int year, int month, int day, double frac); static Date getCurrentDate(); static TimeZone parseTimeZone(String id); static SimpleDateFormat getNewGmtSimpleDateFormat(String format); static SimpleDateFormat getNewGmtSimpleDateFormat(String format, boolean lenient); static Calendar getGmtGregorianCalendar(); static Calendar getGmtGregorianCalendar(int year, int month, int dayOfMonth); static long parseDuration(String strDuration); static final long SECONDS_IN_MINUTE; static final long MINUTES_IN_HOUR; static final long HOURS_IN_DAY; static final long DAYS_IN_WEEK; static final long MILLIS_IN_SECOND; static final long HALF_MILLIS_IN_SECOND; static final long MILLIS_IN_MINUTE; static final long MILLIS_IN_HOUR; static final long MILLIS_IN_DAY; static final long MILLIS_IN_WEEK; static final TimeZone GMT_TIMEZONE; static final LazyObj<TimeZone> ADE_TIMEZONE; }
@Test public void testParseTimeZoneGMT1() throws AdeUsageException{ assertEquals("Parsing GMT ",TimeZone.getTimeZone("GMT"),DateTimeUtils.parseTimeZone("GMT")); }
@Test public void testParseTimeZoneGMT2() throws AdeUsageException{ assertEquals("Parsing GMT+0 ",TimeZone.getTimeZone("GMT"),DateTimeUtils.parseTimeZone("GMT+0")); }
@Test(expected = AdeUsageException.class) public void testParseTimeZoneEmpty() throws AdeUsageException{ assertEquals("Parsing an empty string ",TimeZone.getTimeZone("GMT"),DateTimeUtils.parseTimeZone("")); }