@Override public String marshal(Date arg0) throws Exception { SimpleDateFormat fmt = (SimpleDateFormat) isoFormat.clone(); return fmt.format(arg0); }
@Override public Date unmarshal(String arg0) throws Exception { SimpleDateFormat fmt = (SimpleDateFormat) isoFormat.clone(); return fmt.parse(arg0); }
/** * Get the preferred HTTP specified date format (RFC 1123). * <p> * The date format is scoped to the current thread and may be * used without requiring to synchronize access to the instance when * parsing or formatting. * * @return the preferred of data format. */ public static SimpleDateFormat getPreferredDateFormat() { // returns clone because calling SDF.parse(...) can change time zone return (SimpleDateFormat) dateFormats.get().get(0).clone(); }
/** * Get the preferred HTTP specified date format (RFC 1123). * <p> * The date format is scoped to the current thread and may be * used without requiring to synchronize access to the instance when * parsing or formatting. * * @return the preferred of data format. */ public static SimpleDateFormat getPreferredDateFormat() { // returns clone because calling SDF.parse(...) can change time zone return (SimpleDateFormat) dateFormats.get().get(0).clone(); }
public static Date parseDate(final String date) { try { SimpleDateFormat threadSafeClone = (SimpleDateFormat) DATE_FORMAT.clone(); return threadSafeClone.parse(date); } catch (final ParseException e) { throw new ExchangeException("Illegal date/time format: " + date, e); } }
public static Date parseShortDate(final String date) { try { SimpleDateFormat threadSafeClone = (SimpleDateFormat) DATE_FORMAT_SHORT.clone(); return threadSafeClone.parse(date); } catch (final ParseException e) { throw new ExchangeException("Illegal date/time format: " + date, e); } }
@Override public Object clone() { JacksonThymeleafISO8601DateFormat other = (JacksonThymeleafISO8601DateFormat) super.clone(); other.dateFormat = (SimpleDateFormat) dateFormat.clone(); return other; }
@Override protected SimpleDateFormat[] initialValue() { SimpleDateFormat[] arr = new SimpleDateFormat[Resolution.MILLISECOND.formatLen+1]; for (Resolution resolution : Resolution.values()) { arr[resolution.formatLen] = (SimpleDateFormat)resolution.format.clone(); } return arr; } };
@Override public void registerCustomEditors(PropertyEditorRegistry registry) { registry.registerCustomEditor(Date.class, new CustomDateEditor((DateFormat) DATE_FORMAT.clone(), false)); } });
return localSimpleDateFormat.get().clone();
df = (SimpleDateFormat) df.clone();
df = (SimpleDateFormat) df.clone();
/** * Overrides Cloneable. * * @return a clone of this instance * @since JavaMail 1.6 */ @Override public MailDateFormat clone() { return (MailDateFormat) super.clone(); }
private SimpleDateFormat dtFormat(int length) { switch (length) { case 24: return (SimpleDateFormat) dateTimeProto24.clone(); case 23: return (SimpleDateFormat) dateTimeProto23.clone(); case 22: return (SimpleDateFormat) dateTimeProto22.clone(); case 20: return (SimpleDateFormat) dateTimeProto20.clone(); default: return (SimpleDateFormat) dateTimeProto24.clone(); } }
df = (SimpleDateFormat) df.clone();
public static Date parseDateAndTime(String dateAndTimeString) { try { SimpleDateFormat clonedDateFormat = (SimpleDateFormat) FEEL_DATE_AND_TIME_FORMAT.clone(); return clonedDateFormat.parse(dateAndTimeString); } catch (ParseException e) { throw LOG.invalidDateAndTimeFormat(dateAndTimeString, e); } }
/** * Get the current user's time format Will look similar to "hh:mm a". Depends on user's locale. * * @return a simple time format * @should return a pattern with two h characters in it * @should not allow the returned SimpleDateFormat to be modified * @since 1.9 */ public static SimpleDateFormat getTimeFormat(Locale locale) { if (timeFormatCache.containsKey(locale)) { return (SimpleDateFormat) timeFormatCache.get(locale).clone(); } SimpleDateFormat sdf = (SimpleDateFormat) DateFormat.getTimeInstance(DateFormat.SHORT, locale); String pattern = sdf.toPattern(); if (!(pattern.contains("hh") || pattern.contains("HH"))) { // otherwise, change the pattern to be a two digit hour pattern = pattern.replaceFirst("h", "hh").replaceFirst("H", "HH"); sdf.applyPattern(pattern); } timeFormatCache.put(locale, sdf); return (SimpleDateFormat) sdf.clone(); }
@Override public SimpleDateFormat[] get() { SimpleDateFormat[] simpleDateFormatsCopy = new SimpleDateFormat[simpleDateFormats.length]; for(int i = 0; i < simpleDateFormats.length; i++) { simpleDateFormatsCopy[i] = (SimpleDateFormat) simpleDateFormats[i].clone(); } return simpleDateFormatsCopy; } });
@Override public SimpleDateFormat get() { return (SimpleDateFormat) simpleDateFormat.clone(); } });