Parse a string to {@link Date}, based on the specified {@code format}.

@param source
@param format
@return
978304
public static Date fromString(String source, String format) {
        try {
            ObjectPool<DateFormat> pool = cachedDateFormat.get(format);
            try {
                DateFormat df = pool.borrowObject();
                try {
                    return df.parse(source);
                } finally {
                    pool.returnObject(df);
                }
            } catch (Exception e) {
                throw e instanceof RuntimeException ? (RuntimeException) e
                        : new RuntimeException(e);
            }
        } catch (ExecutionException e) {
            throw new RuntimeException(e);
        }
    }
293204
public Timestamp parse(String source, ParsePosition pos) {
        if (nanoPattern)
            throw new UnsupportedOperationException("Not supporting parsing of nanosecond field.");
        return Timestamp.of(dateFormat.parse(source, pos));
    }
922937
private long parseDateTime(String str, String format)
    {
        return FormatUtilities.getDateTime(str, format, false, true);
    }
9213
public static Time parseTime(final String date, final String format, final TimeZone timeZone) {
        if (N.isNullOrEmpty(date) || (date.length() == 4 && "null".equalsIgnoreCase(date))) {
            return null;
        }

        return createTime(parse(date, format, timeZone));
    }
1099738
public static Date autoParseDateFormat(String dateString) {
		// STEP 1: try to detect standard locale based java date format
		for (Locale locale : DateFormat.getAvailableLocales()) {
			for (int style = DateFormat.FULL; style <= DateFormat.SHORT; style++) {
				DateFormat df = DateFormat.getDateInstance(style, locale);
				try {
					return df.parse(dateString);
					// either return "true", or return the Date obtained Date
					// object
				} catch (ParseException ex) {
					continue; // unparsable, try the next one
				}
			}
		}

		// STEP 2: if the date format was not found, check with predefined dates
		String format = determineDateFormat(dateString);
		if (format != null) {
			DateFormat df = new SimpleDateFormat(format);
			try {
				return df.parse(dateString);
			} catch (ParseException e) {
				return null;
			}
		}
		return null;
	}
1130139
public PactDslJsonArray time(String format, Date example) {
        FastDateFormat instance = FastDateFormat.getInstance(format);
        body.put(instance.format(example));
        matchers.addRule(rootPath + appendArrayIndex(0), matchTime(format));
        return this;
    }
1141854
public static String dateToStr(Date date, String format) {
        return new SimpleDateFormat(format).format(date);
    }
401119
@Trivial
    public void setFormatString(String format) {
        this.stringFormat = format;
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Set access format to " + format);
        }
        parseFormat();
    }
817941
public static Date strToDateWithFormat(String strDate, Format format) {
        SimpleDateFormat localFormat = (SimpleDateFormat) format;
        ParsePosition pos = new ParsePosition(0);
        Date strtodate = localFormat.parse(strDate, pos);
        return strtodate;
    }
1206859
@NonNull
    public static String getNowDateTime(@NonNull String format) {
        SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH);
        Date curDate = new Date(System.currentTimeMillis());
        return formatter.format(curDate);
    }
199606
public String getFormattedDate(String format) {
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
        return dateFormat.format(date);
    }
127128
public static String dateToString(final Date date, final String format) {
        if (date == null) {
            return null;
        }
        final DateFormat dateFormat = new SimpleDateFormat(format, Locale.US);
        return dateFormat.format(date);
    }
976491
public static JTextField getDateField(String format) {
        JTextField field = new JTextField();
        field.setEditable(false);
        timePicker(field);
        return field;
    }
403998
public static String getFormatDate(String format, Date date, String zoneId) {
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(format);
        return dateTimeFormatter
            .format(date.toInstant().atZone(ZoneId.of(zoneId)).toLocalDateTime());
    }
166489
public static java.util.Date parseDate(String dateString, String dateFormat) {
        java.util.Date newDate = null;

        try {
            newDate = new SimpleDateFormat(dateFormat, Locale.ENGLISH)
                    .parse(dateString);
        } catch (ParseException e) {
            QuickUtils.log.d("parse error", e);
        }
        return newDate;
    }
786061
public static PactDslJsonRootValue date(String format) {
    FastDateFormat instance = FastDateFormat.getInstance(format);
    PactDslJsonRootValue value = new PactDslJsonRootValue();
    value.generators.addGenerator(Category.BODY, "", new DateGenerator(format));
    value.setValue(instance.format(new Date(DATE_2000)));
    value.setMatcher(value.matchDate(format));
    return value;
  }
1329368
protected String dateToString(LocalDate localDate, String format) {
        return localDate == null ? "----------" : localDate.toString(format);
    }