DateUtils { public static String formatDate(Date date) { return formatDate(date, PATTERN_RFC1123); } private  DateUtils(); static Date parseDate(String dateValue); static Date parseDate(final String dateValue, String[] dateFormats); static Date parseDate(
        String dateValue,
        String[] dateFormats,
        Date startDate
    ); static String formatDate(Date date); static String formatDate(Date date, String pattern); static final String PATTERN_RFC1123; static final String PATTERN_RFC1036; static final String PATTERN_ASCTIME; static final TimeZone GMT; }
@Test public void testBasicDateFormat() throws Exception { Calendar calendar = Calendar.getInstance(); calendar.setTimeZone(DateUtils.GMT); calendar.set(2005, Calendar.OCTOBER, 14, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); Date date = calendar.getTime(); Assert.assertEquals("Fri, 14 Oct 2005 00:00:00 GMT", DateUtils.formatDate(date)); Assert.assertEquals("Fri, 14 Oct 2005 00:00:00 GMT", DateUtils.formatDate(date, DateUtils.PATTERN_RFC1123)); }