Java Utililty Methods Date Format

List of utility methods to do Date Format

Description

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

Method

StringformatDate(final java.util.Date date, final Supplier formatSupplier)
format Date
final DateFormat dateFormat = formatSupplier.get();
if (dateFormat == null) {
    return String.valueOf((date).getTime());
return dateFormat.format(date);
DateformatDate(int day, int month, int year)
format Date
final SimpleDateFormat dateFormat = new SimpleDateFormat(DATE);
final StringBuilder sb = new StringBuilder();
Date date = new Date();
sb.append(String.valueOf(day) + "-");
sb.append(String.valueOf(month) + "-");
sb.append(String.valueOf(year));
try {
    date = dateFormat.parse(sb.toString());
...
StringformatDate(Integer day, Integer month, Integer year)
format Date
if (year == null) {
    return null;
Date date = new GregorianCalendar(year, month != null ? month - 1 : 0, day != null ? day : 1).getTime();
if (month == null) {
    return new SimpleDateFormat("yyyy").format(date);
} else if (day == null) {
    return new SimpleDateFormat("yyyy-MM").format(date);
...
StringformatDate(java.util.Calendar in)
convert a Calendar into a readable string
return (formatDate(in.getTime()));
StringformatDate(java.util.Date date)
format Date
return format(date, "yyyy-MM-dd");
StringformatDate(java.util.Date paramDate)
format Date
if (paramDate == null)
    return null;
SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
localSimpleDateFormat.setLenient(false);
return localSimpleDateFormat.format(paramDate);
StringformatDate(Object obj)
format Date
if (obj == null) {
    return "";
try {
    java.util.Date dateval = (java.util.Date) obj;
    SimpleDateFormat dateformat = new SimpleDateFormat("MM/dd/yyyy");
    dateformat.setLenient(false);
    return dateformat.format(dateval);
...
StringformatDate6(Date date)
format Date
return dateFormat6.format(date);