本文整理了Java中java.text.SimpleDateFormat.toLocalizedPattern()
方法的一些代码示例,展示了SimpleDateFormat.toLocalizedPattern()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SimpleDateFormat.toLocalizedPattern()
方法的具体详情如下:
包路径:java.text.SimpleDateFormat
类名称:SimpleDateFormat
方法名:toLocalizedPattern
[英]Returns the pattern of this simple date format using localized pattern characters.
[中]使用本地化的模式字符返回此简单日期格式的模式。
代码示例来源:origin: stackoverflow.com
Format dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext());
String pattern = ((SimpleDateFormat) dateFormat).toLocalizedPattern();
代码示例来源:origin: stackoverflow.com
SimpleDateFormat sf = (SimpleDateFormat) f;
String p1 = sf.toPattern();
String p2 = sf.toLocalizedPattern();
代码示例来源:origin: rey5137/material
private boolean isMonthFirst(){
SimpleDateFormat format = (SimpleDateFormat)SimpleDateFormat.getDateInstance(SimpleDateFormat.FULL);
String pattern = format.toLocalizedPattern();
return pattern.indexOf("M") < pattern.indexOf("d");
}
代码示例来源:origin: stackoverflow.com
DateFormat formatter = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault());
String pattern = ((SimpleDateFormat)formatter).toPattern();
String localPattern = ((SimpleDateFormat)formatter).toLocalizedPattern();
代码示例来源:origin: pentaho/pentaho-kettle
/**
* Returns a localized pattern string describing this date format.
*
* @return a localized pattern string describing this date format.
*/
@Override
public String toLocalizedPattern() {
if ( compatibleToSuperPattern ) {
return super.toLocalizedPattern();
} else {
StringBuffer pattern =
new StringBuffer( super.toLocalizedPattern() );
int placeholderPosition = replaceHolder( pattern, true );
for ( int i = placeholderPosition; i <= endNanosecondPatternPosition - startNanosecondPatternPosition + placeholderPosition; i++ ) {
pattern.insert( i, patternNanosecond );
}
return pattern.toString();
}
}
代码示例来源:origin: stackoverflow.com
return localSimpleDateFormat.get().toLocalizedPattern();
代码示例来源:origin: pentaho/pentaho-kettle
data.daf.applyPattern( field.getFormat() );
} else {
data.daf.applyPattern( data.defaultDateFormat.toLocalizedPattern() );
代码示例来源:origin: stackoverflow.com
DateFormat fmt = DateFormat.getPatternInstance(
DateFormat.YEAR_MONTH,
Locale.forLanguageTag("pl-PL"));
if (fmt instanceof SimpleDateFormat) {
SimpleDateFormat sfmt = (SimpleDateFormat) fmt;
String pattern = sfmt.toPattern();
String localizedPattern = sfmt.toLocalizedPattern();
System.out.println(pattern);
System.out.println(localizedPattern);
}
代码示例来源:origin: apache/metron
@Nullable
@Override
public Option apply(@Nullable String s) {
String defaultFormat = new SimpleDateFormat().toLocalizedPattern();
Option o = new Option(s, "as_of_format", true, "The format of the as_of time (only used in conjunction with the as_of option) (Default is: " + defaultFormat + ")");
o.setArgName("format");
o.setRequired(false);
return o;
}
})
代码示例来源:origin: stackoverflow.com
String localizedPattern = sdf.toLocalizedPattern()
println "country: " + l.getDisplayName();
println "pattern: " + pattern;
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OpenmrsUtil#getDateFormat(Locale)
*/
@Test
public void getDateFormat_shouldReturnAPatternWithFourYCharactersInIt() {
Assert.assertEquals("MM/dd/yyyy", OpenmrsUtil.getDateFormat(Locale.US).toLocalizedPattern());
Assert.assertEquals("dd/MM/yyyy", OpenmrsUtil.getDateFormat(Locale.UK).toLocalizedPattern());
Assert.assertEquals("tt.MM.uuuu", OpenmrsUtil.getDateFormat(Locale.GERMAN).toLocalizedPattern());
Assert.assertEquals("dd-MM-yyyy", OpenmrsUtil.getDateFormat(new Locale("pt", "pt")).toLocalizedPattern());
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.ibm.icu.base
/**
* Return a localized pattern string describing this date format.
* @stable ICU 2.0
*/
public String toLocalizedPattern() {
return ((java.text.SimpleDateFormat)dateFormat).toLocalizedPattern();
}
代码示例来源:origin: at.bestsolution.eclipse/com.ibm.icu.base
/**
* Return a localized pattern string describing this date format.
* @stable ICU 2.0
*/
public String toLocalizedPattern() {
return ((java.text.SimpleDateFormat)dateFormat).toLocalizedPattern();
}
代码示例来源:origin: stackoverflow.com
DateFormat f = getDateTimeInstance(FULL, FULL, new Locale("nl_NL"));
SimpleDateFormat sf = (SimpleDateFormat) f;
String p1 = sf.toPattern();
String p2 = sf.toLocalizedPattern();
System.out.println( p1 );
System.out.println( p2 );
代码示例来源:origin: stackoverflow.com
Locale locale = httpServletRequest.getLocale();
final Date currentDate = new Date();
final DateFormat dateInstance = DateFormat.getDateInstance(DateFormat.FULL, locale);
final String format = dateInstance.format(currentDate);
System.out.println(format);
if (dateInstance instanceof SimpleDateFormat) {
System.out.println("pattern: " + ((SimpleDateFormat) dateInstance).toPattern());
System.out.println("localized pattern: "+((SimpleDateFormat) dateInstance).toLocalizedPattern());
}
代码示例来源:origin: org.apache.tapestry/tapestry-framework
/**
* @see org.apache.tapestry.form.translator.AbstractTranslator#getMessageParameters(java.util.Locale,
* java.lang.String)
*/
protected Object[] getMessageParameters(Locale locale, String label)
{
String pattern = getDateFormat(locale).toLocalizedPattern().toUpperCase(locale);
return new Object[] { label, pattern };
}
代码示例来源:origin: org.apache.solr/solr-dataimporthandler
protected Date convertStringToDate(String s) {
try {
return dateFormat.parse(s);
} catch (ParseException e) {
throw new DataImportHandlerException(SEVERE, "Value for "
+ LAST_INDEX_KEY + " is invalid for date format "
+ dateFormat.toLocalizedPattern() + " : " + s);
}
}
/**
代码示例来源:origin: org.zkoss.zk/zul
/**
* Returns the localized format, which is used when constructing a datebox.
* <p>
* You might override this method to provide your own localized format.
*/
protected String getLocalizedFormat() {
return new SimpleDateFormat(getRealFormat(), _locale != null ? _locale : Locales.getCurrent())
.toLocalizedPattern();
}
代码示例来源:origin: EvoSuite/evosuite
public String toPattern() {
Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_TEXT_SIMPLEDATEFORMAT, this, "toPattern", "()Ljava/lang/String;", new Object[] {});
String ret = super.toLocalizedPattern();
Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_TEXT_SIMPLEDATEFORMAT, this, ret);
return ret;
}
代码示例来源:origin: EvoSuite/evosuite
public String toLocalizedPattern() {
Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_TEXT_SIMPLEDATEFORMAT, this, "toLocalizedPattern", "()Ljava/lang/String;", new Object[] {});
String ret = super.toLocalizedPattern();
Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_TEXT_SIMPLEDATEFORMAT, this, ret);
return ret;
}
内容来源于网络,如有侵权,请联系作者删除!