本文整理了Java中java.text.SimpleDateFormat.clone()
方法的一些代码示例,展示了SimpleDateFormat.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SimpleDateFormat.clone()
方法的具体详情如下:
包路径:java.text.SimpleDateFormat
类名称:SimpleDateFormat
方法名:clone
[英]Returns a new SimpleDateFormat with the same pattern and properties as this simple date format.
[中]返回与此简单日期格式具有相同模式和属性的新SimpleDataFormat。
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public String marshal(Date arg0) throws Exception {
SimpleDateFormat fmt = (SimpleDateFormat) isoFormat.clone();
return fmt.format(arg0);
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public Date unmarshal(String arg0) throws Exception {
SimpleDateFormat fmt = (SimpleDateFormat) isoFormat.clone();
return fmt.parse(arg0);
}
代码示例来源:origin: jersey/jersey
/**
* 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();
}
代码示例来源:origin: jersey/jersey
/**
* 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();
}
代码示例来源:origin: knowm/XChange
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);
}
}
代码示例来源:origin: knowm/XChange
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);
}
}
代码示例来源:origin: thymeleaf/thymeleaf
@Override
public Object clone() {
JacksonThymeleafISO8601DateFormat other = (JacksonThymeleafISO8601DateFormat) super.clone();
other.dateFormat = (SimpleDateFormat) dateFormat.clone();
return other;
}
代码示例来源:origin: org.apache.lucene/lucene-core
@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;
}
};
代码示例来源:origin: spring-projects/spring-framework
@Override
public void registerCustomEditors(PropertyEditorRegistry registry) {
registry.registerCustomEditor(Date.class, new CustomDateEditor((DateFormat) DATE_FORMAT.clone(), false));
}
});
代码示例来源:origin: stackoverflow.com
return localSimpleDateFormat.get().clone();
代码示例来源:origin: prestodb/presto
df = (SimpleDateFormat) df.clone();
代码示例来源:origin: redisson/redisson
df = (SimpleDateFormat) df.clone();
代码示例来源:origin: com.sun.mail/javax.mail
/**
* Overrides Cloneable.
*
* @return a clone of this instance
* @since JavaMail 1.6
*/
@Override
public MailDateFormat clone() {
return (MailDateFormat) super.clone();
}
代码示例来源:origin: ebean-orm/ebean
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();
}
}
代码示例来源:origin: apache/drill
df = (SimpleDateFormat) df.clone();
代码示例来源:origin: camunda/camunda-bpm-platform
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);
}
}
代码示例来源:origin: openmrs/openmrs-core
/**
* 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();
}
代码示例来源:origin: openmrs/openmrs-core
return (SimpleDateFormat) dateFormatCache.get(locale).clone();
return (SimpleDateFormat) sdf.clone();
代码示例来源:origin: arnaudroger/SimpleFlatMapper
@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;
}
});
代码示例来源:origin: arnaudroger/SimpleFlatMapper
@Override
public SimpleDateFormat get() {
return (SimpleDateFormat) simpleDateFormat.clone();
}
});
内容来源于网络,如有侵权,请联系作者删除!