The list of methods to do Year Format are organized into topic(s).
String
format(String day, String month, String year, Locale locale) this method parses the @params String day,month,year to ints, builds a Gregorian Calendar with these values to get the corresponding Date that is returned as String by invoking the method format(Date d,Locale locale), that used to parse a Date to a String.
int tag = Integer.parseInt(day);
int monat = Integer.parseInt(month);
int jahr = Integer.parseInt(year);
Calendar cal = new GregorianCalendar(jahr, monat - 1, tag);
Date d = cal.getTime();
return format(d, locale);
String
format2yyyyMMdd(Date date) formatyyyy M Mdd
if (null == date) {
return null;
return new SimpleDateFormat(yyyyMMdd).format(date);
String
formatInyyyyMMdd(java.util.Date date) getCurrentDayInyyyyMMdd: returns the current day.
if (date != null) {
return new SimpleDateFormat("yyyyMMdd").format(date);
} else {
return null;
String
formatMmDdYyyy(final Date date) format the given date as: "MM/dd/yyyy".
SimpleDateFormat sdf = new SimpleDateFormat(MM_DD_YYYY_DATE_FORMAT_STRING);
return sdf.format(date);
String
formatMonth(int timeInfo, String yearInfo) format Month
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.set(Calendar.MONTH, timeInfo - 1);
cal.set(Calendar.YEAR, Integer.parseInt(yearInfo));
SimpleDateFormat formatter = new SimpleDateFormat("MMM-yyyy");
return formatter.format(cal.getTime());
String
formatNanosYearGMT(long nanos) format Nanos Year GMT
long millis = nanos / 1000000;
Date d = new Date(millis);
synchronized (GMT_FORMAT_MILLIS_NO_Z) {
return GMT_FORMAT_YEAR_NO_Z.format(d);