Java Utililty Methods Date Format

List of utility methods to do Date Format

  1. HOME
  2. Java
  3. D
  4. Date Format

Description

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

Method

String convertDateToBulgarianFormat(Date date)
convert Date To Bulgarian Format
String dateInBulgarianFormat = dateFormatBulgarian.format(date);
return dateInBulgarianFormat;
String convertDateToCustomFormat(Date date, String datePattern)
convert Date To Custom Format
SimpleDateFormat dateFormatCustom = new SimpleDateFormat(datePattern);
String dateInCustomFormat = dateFormatCustom.format(date);
return dateInCustomFormat;
String convertDateToDateString(Date date)
Converts an instance of java.util.Date into a String using the date format: yyyy-MM-ddZ.
if (date == null) {
 return null;
} else {
 DateFormat df = new SimpleDateFormat("yyyy-MM-dd'Z'");
 df.setTimeZone(TimeZone.getTimeZone("UTC"));
 return df.format(date);
String convertDateToFileName(final Date datum)
konvertiere ein Date in ein lesbareres format.
final Calendar calendar = Calendar.getInstance();
calendar.setTime(datum);
final SimpleDateFormat format = new SimpleDateFormat(DATE_FILE_FORMAT_PATTERN);
return format.format(datum);
String convertDateToGMTDateString(Date date)
convert Date To GMT Date String
SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z");
TimeZone tz = TimeZone.getTimeZone("GMT");
sdf.setTimeZone(tz);
String dateStr = sdf.format(date);
return dateStr;
String convertDateToHour(Date d)
convert Date To Hour
SimpleDateFormat df = new SimpleDateFormat("HH", new DateFormatSymbols());
return df.format(d);
String convertDateToISO8601(Date date)
Method that converts a Java date to an ISO 8601 string
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
return dateFormat.format(date);
String convertDateToMMDDYYYY(Date date)
Converts a date object into MM/dd/YYYY.
return MMDDYYYYFormat.format(date);
String convertDateToRpcFormat(Date date)
convert Date To Rpc Format
if (date == null)
 return "";
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
String mDateFormat = "";
...
String convertDateToString(Date aDate)
This method generates a string representation of a date based on the System Property 'dateFormat' in the format you specify on input
return getDateTime(getDatePattern(), aDate);


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