@Test public void testFormatYear() { Calendar cal = simpleCalendar(); String formatted = DateUtils.formatYear(cal.getTime(), Locale.GERMANY); assertEquals("0001", formatted); }
public static String formatYear(Date d, Locale locale) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy", getSafeLocale(locale)); Calendar c = Calendar.getInstance(getSafeLocale(locale)); c.setTime(d); return sdf.format(d); }
DateUtils { public static String formatYear(Date d, Locale locale) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy", getSafeLocale(locale)); Calendar c = Calendar.getInstance(getSafeLocale(locale)); c.setTime(d); return sdf.format(d); } }
DateUtils { public static String formatYear(Date d, Locale locale) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy", getSafeLocale(locale)); Calendar c = Calendar.getInstance(getSafeLocale(locale)); c.setTime(d); return sdf.format(d); } private  DateUtils(); }
DateUtils { public static String formatYear(Date d, Locale locale) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy", getSafeLocale(locale)); Calendar c = Calendar.getInstance(getSafeLocale(locale)); c.setTime(d); return sdf.format(d); } private  DateUtils(); static Date getDateNow(); static Date getTimeNow(); static Date addDate(Date date, int years, int months, int days); static Date setDate(Date date, int year, int month, int day); static Date getDate(int year, int month, int day); static Date setTime(Date date, int hours, int minutes, int seconds, int millis); static Date getDateOnly(Date date); static Date parseDate(String sDate, Locale locale); static String formatDate(Date d, Locale locale); static String formatTime(Date d, Locale locale, boolean withSeconds); static String formatDayOfWeek(Date d, Locale locale, boolean longFormat); static String formatMonth(Date d, Locale locale, boolean longFormat); static int getWeekOfYear(Date d, Locale locale); static String formatMonth(int month, Locale locale, boolean longFormat); static String formatYear(Date d, Locale locale); }
DateUtils { public static String formatYear(Date d, Locale locale) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy", getSafeLocale(locale)); Calendar c = Calendar.getInstance(getSafeLocale(locale)); c.setTime(d); return sdf.format(d); } private  DateUtils(); static Date getDateNow(); static Date getTimeNow(); static Date addDate(Date date, int years, int months, int days); static Date setDate(Date date, int year, int month, int day); static Date getDate(int year, int month, int day); static Date setTime(Date date, int hours, int minutes, int seconds, int millis); static Date getDateOnly(Date date); static Date parseDate(String sDate, Locale locale); static String formatDate(Date d, Locale locale); static String formatTime(Date d, Locale locale, boolean withSeconds); static String formatDayOfWeek(Date d, Locale locale, boolean longFormat); static String formatMonth(Date d, Locale locale, boolean longFormat); static int getWeekOfYear(Date d, Locale locale); static String formatMonth(int month, Locale locale, boolean longFormat); static String formatYear(Date d, Locale locale);  }