本文整理了Java中org.joda.time.format.DateTimeFormatter.getLocale()
方法的一些代码示例,展示了DateTimeFormatter.getLocale()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTimeFormatter.getLocale()
方法的具体详情如下:
包路径:org.joda.time.format.DateTimeFormatter
类名称:DateTimeFormatter
方法名:getLocale
[英]Gets the locale that will be used for printing and parsing.
[中]获取将用于打印和分析的区域设置。
代码示例来源:origin: joda-time/joda-time
/**
* Returns a new formatter with a different locale that will be used
* for printing and parsing.
* <p>
* A DateTimeFormatter is immutable, so a new instance is returned,
* and the original is unaltered and still usable.
*
* @param locale the locale to use; if null, formatter uses default locale
* at invocation time
* @return the new formatter
*/
public DateTimeFormatter withLocale(Locale locale) {
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new DateTimeFormatter(iPrinter, iParser, locale,
iOffsetParsed, iChrono, iZone, iPivotYear, iDefaultYear);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Returns a new formatter with a different locale that will be used
* for printing and parsing.
* <p>
* A DateTimeFormatter is immutable, so a new instance is returned,
* and the original is unaltered and still usable.
*
* @param locale the locale to use; if null, formatter uses default locale
* at invocation time
* @return the new formatter
*/
public DateTimeFormatter withLocale(Locale locale) {
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new DateTimeFormatter(iPrinter, iParser, locale,
iOffsetParsed, iChrono, iZone, iPivotYear, iDefaultYear);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public Locale locale() {
return printer.getLocale();
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Returns a new formatter with a different locale that will be used
* for printing and parsing.
* <p>
* A DateTimeFormatter is immutable, so a new instance is returned,
* and the original is unaltered and still usable.
*
* @param locale the locale to use; if null, formatter uses default locale
* at invocation time
* @return the new formatter
*/
public DateTimeFormatter withLocale(Locale locale) {
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new DateTimeFormatter(iPrinter, iParser, locale,
iOffsetParsed, iChrono, iZone, iPivotYear, iDefaultYear);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* Returns a new formatter with a different locale that will be used
* for printing and parsing.
* <p>
* A DateTimeFormatter is immutable, so a new instance is returned,
* and the original is unaltered and still usable.
*
* @param locale the locale to use; if null, formatter uses default locale
* at invocation time
* @return the new formatter
*/
public DateTimeFormatter withLocale(Locale locale) {
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new DateTimeFormatter(iPrinter, iParser, locale,
iOffsetParsed, iChrono, iZone, iPivotYear, iDefaultYear);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Returns a new formatter with a different locale that will be used
* for printing and parsing.
* <p>
* A DateTimeFormatter is immutable, so a new instance is returned,
* and the original is unaltered and still usable.
*
* @param locale the locale to use; if null, formatter uses default locale
* at invocation time
* @return the new formatter
*/
public DateTimeFormatter withLocale(Locale locale) {
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new DateTimeFormatter(iPrinter, iParser, locale,
iOffsetParsed, iChrono, iZone, iPivotYear, iDefaultYear);
}
代码示例来源:origin: Nextdoor/bender
/**
* Returns a new formatter with a different locale that will be used
* for printing and parsing.
* <p>
* A DateTimeFormatter is immutable, so a new instance is returned,
* and the original is unaltered and still usable.
*
* @param locale the locale to use; if null, formatter uses default locale
* at invocation time
* @return the new formatter
*/
public DateTimeFormatter withLocale(Locale locale) {
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new DateTimeFormatter(iPrinter, iParser, locale,
iOffsetParsed, iChrono, iZone, iPivotYear, iDefaultYear);
}
代码示例来源:origin: org.joda/com.springsource.org.joda.time
/**
* Returns a new formatter with a different locale that will be used
* for printing and parsing.
* <p>
* A DateTimeFormatter is immutable, so a new instance is returned,
* and the original is unaltered and still usable.
*
* @param locale the locale to use; if null, formatter uses default locale
* at invocation time
* @return the new formatter
*/
public DateTimeFormatter withLocale(Locale locale) {
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new DateTimeFormatter(iPrinter, iParser, locale,
iOffsetParsed, iChrono, iZone, iPivotYear);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Returns a new formatter with a different locale that will be used
* for printing and parsing.
* <p>
* A DateTimeFormatter is immutable, so a new instance is returned,
* and the original is unaltered and still usable.
*
* @param locale the locale to use; if null, formatter uses default locale
* at invocation time
* @return the new formatter
*/
public DateTimeFormatter withLocale(Locale locale) {
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new DateTimeFormatter(iPrinter, iParser, locale,
iOffsetParsed, iChrono, iZone, iPivotYear, iDefaultYear);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Returns a new formatter with a different locale that will be used
* for printing and parsing.
* <p>
* A DateTimeFormatter is immutable, so a new instance is returned,
* and the original is unaltered and still usable.
*
* @param locale the locale to use; if null, formatter uses default locale
* at invocation time
* @return the new formatter
*/
public DateTimeFormatter withLocale(Locale locale) {
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new DateTimeFormatter(iPrinter, iParser, locale,
iOffsetParsed, iChrono, iZone, iPivotYear, iDefaultYear);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time
/**
* Returns a new formatter with a different locale that will be used
* for printing and parsing.
* <p>
* A DateTimeFormatter is immutable, so a new instance is returned,
* and the original is unaltered and still usable.
*
* @param locale the locale to use; if null, formatter uses default locale
* at invocation time
* @return the new formatter
*/
public DateTimeFormatter withLocale(Locale locale) {
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new DateTimeFormatter(iPrinter, iParser, locale,
iOffsetParsed, iChrono, iZone, iPivotYear, iDefaultYear);
}
代码示例来源:origin: redfish64/TinyTravelTracker
/**
* Returns a new formatter with a different locale that will be used
* for printing and parsing.
* <p>
* A DateTimeFormatter is immutable, so a new instance is returned,
* and the original is unaltered and still usable.
*
* @param locale the locale to use; if null, formatter uses default locale
* at invocation time
* @return the new formatter
*/
public DateTimeFormatter withLocale(Locale locale) {
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new DateTimeFormatter(iPrinter, iParser, locale,
iOffsetParsed, iChrono, iZone, iPivotYear, iDefaultYear);
}
代码示例来源:origin: CloudSlang/cs-actions
/**
* Returns a LocalDateTime depending on how the date passes as argument is formatted.
*
* @param date date passed as argument
* @return the DateTime if it could parse it
*/
public static DateTime getJodaOrJavaDate(final DateTimeFormatter dateFormatter, final String date) throws Exception {
if (DateTimeUtils.isDateValid(date, dateFormatter.getLocale())) {
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, dateFormatter.getLocale());
Calendar dateCalendar = GregorianCalendar.getInstance();
dateCalendar.setTime(dateFormat.parse(date));
return new DateTime(dateCalendar.getTime());
}
return new DateTime(date);
}
代码示例来源:origin: stackoverflow.com
LocalDate localDate = LocalDate.of ( 2015 , 12 , 28 );
String builtIn = localDate.format ( DateTimeFormatter.ISO_WEEK_DATE ); // 2015-W53-1
DateTimeFormatter formatter = DateTimeFormatter.ofPattern ( "YYYY'-W'ww'-'e" );
formatter = formatter.withLocale ( Locale.GERMANY ); // 2015-W53-1
String custom = localDate.format ( formatter );
System.out.println ( "formatter.locale: " + formatter.getLocale () + " | localDate: " + localDate + " | builtIn: " + builtIn + " | custom: " + custom );
formatter = formatter.withLocale ( Locale.US ); // 2016-W01-2
custom = localDate.format ( formatter );
System.out.println ( "formatter.locale: " + formatter.getLocale () + " | localDate: " + localDate + " | builtIn: " + builtIn + " | custom: " + custom );
内容来源于网络,如有侵权,请联系作者删除!