DateTimeUtils { static public Calendar getGmtGregorianCalendar() { Calendar res = new GregorianCalendar(DateTimeUtils.GMT_TIMEZONE); res.setFirstDayOfWeek(MONDAY); 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 testGetGmtGregorianCalendar(){ TimeZone GMT_TIMEZONE = TimeZone.getTimeZone("GMT"); Calendar res = new GregorianCalendar(GMT_TIMEZONE); res.setFirstDayOfWeek(2); res.set(Calendar.YEAR, 2015); res.set(Calendar.MONTH, 12); res.set(Calendar.DAY_OF_MONTH, 7); res.set(Calendar.HOUR_OF_DAY, 0); res.set(Calendar.MINUTE, 0); res.set(Calendar.SECOND, 0); res.set(Calendar.MILLISECOND, 0); assertEquals("Making a Gregorian Calendar ",res,DateTimeUtils.getGmtGregorianCalendar(2015,12,7)); }