Sets the date format for this element.
It also changes the date format for the date validator, if present.
@param dateFormat Date format
@return This element
542497
public DatePicker setDateFormat(SimpleDateFormat dateFormat) {
        this.dateFormat = dateFormat;
        for (Validator validator : this.getValidators()) {
            if (validator instanceof DateValidator) {
                ((DateValidator) validator).setDateFormat(dateFormat);
            }
        }
        return this;
    }
130857
public static SimpleDateFormat newDateFormat(String format) {
		SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.ROOT);
		sdf.setLenient(false);
		return sdf;
	}
123716
private SimpleDateFormat createDateTimeTimeZoneFormat() {
		SimpleDateFormat dateTimeTimeZoneFormat = new SimpleDateFormat( DATE_TIME_TIMEZONE_FORMAT );
		dateTimeTimeZoneFormat.setLenient( false );
		return dateTimeTimeZoneFormat;
	}
591089
public void setDateFormatString(String dfString) {
		for (int i = 0; i < 4; i++) {
			((JDateChooser) components[i]).setDateFormatString(dfString);
		}
	}
1149927
public static String format(final Date date, final String format) {
		return format(date.getTime(), format);
	}
201570
public static Cell setCellValue(Cell cell, Object value, String dateFormat) {
        SimpleDateFormat format =
                new SimpleDateFormat(StringUtils.isNotBlank(dateFormat) ? dateFormat : DATE_PATTERN);
        if (value == null) {
            cell.setCellValue("");
        } else if (value instanceof String) {
            cell.setCellValue((String) value);
        } else if (value instanceof Integer) {
            cell.setCellValue((Integer) value);
        } else if (value instanceof Date) {
            cell.setCellValue(format.format(value));
        } else if (value instanceof Calendar) {
            cell.setCellValue(format.format(((Calendar) value).getTime()));
        } else if (value instanceof Boolean) {
            cell.setCellValue((Boolean) value);
        } else if (value instanceof Float) {
            cell.setCellValue((Float) value);
        } else if (value instanceof Double) {
            cell.setCellValue((Double) value);
        } else if (value instanceof Byte) {
            cell.setCellValue((Byte) value);
        } else if (value instanceof Short) {
            cell.setCellValue((Short) value);
        } else if (value instanceof Long) {
            cell.setCellValue((Long) value);
        } else if (value instanceof Character) {
            cell.setCellValue(((Character) value).toString());
        } else {
            cell.setCellValue(value.toString());
        }
        return cell;
    }
898590
private Date getDate(final String isoFormat) {
		try {
			final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
			return dateFormat.parse(isoFormat);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}
159915
@Override
	public D withFormat(FormatDescriptor format) {
		formatDescriptor = Optional.of(Preconditions.checkNotNull(format));
		return (D) this;
	}
1109765
public static Date convertDate(Object target, String dateTimeFormat) {
        if (target instanceof JsonNode) {
            return convertDate((JsonNode) target, dateTimeFormat);
        }
        return target instanceof Number ? new Date(((Number) target).longValue())
                : (target instanceof String
                        ? DateFormatUtils.fromString(target.toString(), dateTimeFormat)
                        : (target instanceof Date ? (Date) target : null));
    }
488529
public static String format(final Calendar date, final String format) {
		return format(date.getTime(), format);
	}
943509
public static Date stringToDate(String dateText, String format,
                                    boolean lenient) {

        if (dateText == null) {

            return null;
        }

        DateFormat df = null;

        try {

            if (format == null) {
                df = new SimpleDateFormat();
            } else {
                df = new SimpleDateFormat(format);
            }

            // setLenient avoids allowing dates like 9/32/2001
            // which would otherwise parse to 10/2/2001
            df.setLenient(false);

            return df.parse(dateText);
        } catch (ParseException e) {

            return null;
        }
    }
1068305
public static String getCalendarJavaDateFormat(String dateFormat) {

        dateFormat = CmsStringUtil.substitute(dateFormat, "%", ""); // remove all "%"
        dateFormat = CmsStringUtil.substitute(dateFormat, "m", "${month}");
        dateFormat = CmsStringUtil.substitute(dateFormat, "H", "${hour}");
        dateFormat = CmsStringUtil.substitute(dateFormat, "Y", "${4anno}");
        dateFormat = dateFormat.toLowerCase();
        dateFormat = CmsStringUtil.substitute(dateFormat, "${month}", "M");
        dateFormat = CmsStringUtil.substitute(dateFormat, "${hour}", "H");
        dateFormat = CmsStringUtil.substitute(dateFormat, "y", "yy");
        dateFormat = CmsStringUtil.substitute(dateFormat, "${4anno}", "yyyy");
        dateFormat = CmsStringUtil.substitute(dateFormat, "m", "mm"); // minutes with two digits
        dateFormat = dateFormat.replace('e', 'd'); // day of month
        dateFormat = dateFormat.replace('i', 'h'); // 12 hour format
        dateFormat = dateFormat.replace('p', 'a'); // pm/am String
        return dateFormat;
    }
504705
public String getFormattedDate(DateFormat formatter){
        mCalendar.set(Calendar.YEAR, mAdapter.getYear());
        mCalendar.set(Calendar.MONTH, mAdapter.getMonth());
        mCalendar.set(Calendar.DAY_OF_MONTH, mAdapter.getDay());
        return formatter.format(mCalendar.getTime());
    }
973927
public SimpleDateFormat getFormat(String format)
    {
        SimpleDateFormat f = (SimpleDateFormat)get();
        f.applyPattern(format);
        return f;
    }
533852
public void setDate(String dateString)
    {
		Date date = null;
		try	{
            if ((dateString != null) && (dateString.length() > 0))
                date = dateFormat.parse(dateString);
		} catch (Exception e)	{
            date = null;
		}
        this.setDate(date);
    }
31127
public function setDateFormat($format = null, $dateIntervalFormat = null)
    {
        if (null !== $format) {
            $this->dateFormats[0] = $format;
        }

        if (null !== $dateIntervalFormat) {
            $this->dateFormats[1] = $dateIntervalFormat;
        }
    }
889734
@Nonnull
    @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
    public String format(@Nonnull Date date) {
        SimpleDateFormat dateFormat = dateFormats.poll();
        if (dateFormat == null) {
            dateFormat = new SimpleDateFormat(pattern, locale);
            dateFormat.setTimeZone(timeZone);
        }
        try {
            return dateFormat.format(date);
        } finally {
            dateFormats.offer(dateFormat);
        }
    }