Java Utililty Methods Year Format

List of utility methods to do Year Format

  1. HOME
  2. Java
  3. Y
  4. Year Format

Description

The list of methods to do Year Format are organized into topic(s).

Method

String format(final int iDay, final int iMonth, final int iYear)
Format the given day, month and year ( in ISO format )
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_ISO_FORMAT);
return dateFormat.format(getUtilDate(iDay, iMonth, iYear));
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 format_D_MM_YYYY_HH_MM(Date date)
convierte date en su representacion texto en formato d/MM/yyyy HH:mm
return SDF_D_MM_YYYY_HH_MM.format(date);
String formateDate2yyyyMMdd()
formate Dateyyyy M Mdd
return formateCurrentDate2String(YYYYMMDD);
String formatInyyyyMMdd(java.util.Date date)
getCurrentDayInyyyyMMdd: returns the current day.
if (date != null) {
 return new SimpleDateFormat("yyyyMMdd").format(date);
} else {
 return null;
String formatMdDdYySlashed(Date date)
Formats a date object to "MM/dd/yy".
if (date == null) {
 return "";
return formatSlashedMmDdYy().format(date);
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);


AltStyle によって変換されたページ (->オリジナル) /