java.text.SimpleDateFormat.applyLocalizedPattern()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中java.text.SimpleDateFormat.applyLocalizedPattern()方法的一些代码示例,展示了SimpleDateFormat.applyLocalizedPattern()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SimpleDateFormat.applyLocalizedPattern()方法的具体详情如下:
包路径:java.text.SimpleDateFormat
类名称:SimpleDateFormat
方法名:applyLocalizedPattern

SimpleDateFormat.applyLocalizedPattern介绍

[英]Changes the pattern of this simple date format to the specified pattern which uses localized pattern characters.
[中]将此简单日期格式的模式更改为使用本地化模式字符的指定模式。

代码示例

代码示例来源:origin: wdullaer/MaterialDateTimePicker

@NonNull
private String getMonthAndYearString() {
  Locale locale = mController.getLocale();
  String pattern = "MMMM yyyy";
  if (Build.VERSION.SDK_INT < 18) pattern = getContext().getResources().getString(R.string.mdtp_date_v1_monthyear);
  else pattern = DateFormat.getBestDateTimePattern(locale, pattern);
  SimpleDateFormat formatter = new SimpleDateFormat(pattern, locale);
  formatter.setTimeZone(mController.getTimeZone());
  formatter.applyLocalizedPattern(pattern);
  mStringBuilder.setLength(0);
  return formatter.format(mCalendar.getTime());
}

代码示例来源:origin: pentaho/pentaho-kettle

super.applyLocalizedPattern( patternToApply );
} else {
 super.applyPattern( patternToApply );

代码示例来源:origin: robolectric/robolectric

formatter.applyLocalizedPattern("yyyy-MM-dd");
formatter.applyLocalizedPattern("yyyy-MM-dd'T'HH:mm:ssZ");
long millisInUtc = time.toMillis(false);
try {
} catch (java.text.ParseException e1) {
 formatter.applyLocalizedPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
 formatter.setLenient(true);
 try {

代码示例来源:origin: stackoverflow.com

localSimpleDateFormat.get().applyLocalizedPattern(pattern);

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.ibm.icu.base

/**
 * Apply the given localized pattern string to this date format.
 * @stable ICU 2.0
 */
public void applyLocalizedPattern(String pat) {
  ((java.text.SimpleDateFormat)dateFormat).applyLocalizedPattern(pat);
}

代码示例来源:origin: org.apache.sis.core/sis-utility

/**
 * Sets a user-specified pattern.
 *
 * @param pattern the user-specified pattern.
 */
@Override
public void applyLocalizedPattern(final String pattern) {
  super.applyLocalizedPattern(pattern);
  isUserSpecifiedPattern = true;
}

代码示例来源:origin: at.bestsolution.eclipse/com.ibm.icu.base

/**
 * Apply the given localized pattern string to this date format.
 * @stable ICU 2.0
 */
public void applyLocalizedPattern(String pat) {
  ((java.text.SimpleDateFormat)dateFormat).applyLocalizedPattern(pat);
}

代码示例来源:origin: com.novoda/notils

public void applyLocalizedPattern(String pattern) {
  localSimpleDateFormat.get().applyLocalizedPattern(pattern);
}

代码示例来源:origin: org.sakaiproject.signup/signup-impl

private String getShortWeekDayName(Date date){
  dateFormat.applyLocalizedPattern("EEE");
  return dateFormat.format(date);
}

代码示例来源:origin: novoda/notils

public void applyLocalizedPattern(String pattern) {
  localSimpleDateFormat.get().applyLocalizedPattern(pattern);
}

代码示例来源:origin: pentaho/pentaho-reporting

/**
 * defines the localized formatString for this SimpleDateFormat.
 *
 * @param format
 *          the formatString
 * @throws IllegalArgumentException
 *           if the string is invalid
 */
public void setLocalizedFormatString( final String format ) {
 getSimpleDateFormat().applyLocalizedPattern( format );
}

代码示例来源:origin: ATLauncher/ATLauncher

public static void updateDateFormat() {
    format.applyLocalizedPattern(App.settings.getDateFormat() + " HH:mm:ss a");
  }
}

代码示例来源:origin: org.refcodes/refcodes-date

/**
 * {@inheritDoc}
 * 
 * @deprecated as it is not considered to be thread safe.
 */
@Deprecated
@Override
public void applyLocalizedPattern( String pattern ) {
  super.applyLocalizedPattern( pattern );
  _fastDateFormat = FastDateFormat.getInstance( pattern );
  _parsePatterns = new String[] {
    pattern
  };
}

代码示例来源:origin: jasperreports/jasperreports

/**
 *
 */
protected Object parse(Object value, String pattern) throws ParseException 
{
  SimpleDateFormat formatter = getFormatter(pattern, locale);
  if (pattern != null)
  {
    if (locPattern) {
      formatter.applyLocalizedPattern(pattern);
    }
    else {
      formatter.applyPattern(pattern);
    }
  }
  return formatter.parse((String) value);
}

代码示例来源:origin: stackoverflow.com

SimpleDateFormat sdf = new SimpleDateFormat(); // uses default locale (here for Germany)
System.out.println(sdf.toPattern()); // dd.MM.yy HH:mm
System.out.println(sdf.toLocalizedPattern()); // tt.MM.uu HH:mm

DateFormatSymbols dfs = DateFormatSymbols.getInstance(Locale.GERMANY);
dfs.setLocalPatternChars("GJMTkHmsSEDFwWahKzZYuXL");
sdf.setDateFormatSymbols(dfs);
sdf.applyLocalizedPattern("TT.MM.JJJJ");

System.out.println(sdf.toPattern()); // dd.MM.yyyy
System.out.println(sdf.toLocalizedPattern()); // TT.MM.JJJJ
System.out.println(sdf.format(new Date())); // 20.06.2016

代码示例来源:origin: alhazmy13/HijriDatePicker

@NonNull
private String getMonthAndYearString() {
  Locale locale = mController.getLocale();
  String pattern = "MMMM yyyy";
  if (Build.VERSION.SDK_INT < 18)
    pattern = getContext().getResources().getString(R.string.mdtp_date_v1_monthyear);
  else pattern = DateFormat.getBestDateTimePattern(locale, pattern);
  SimpleDateFormat formatter = new SimpleDateFormat(pattern, locale);
  formatter.setTimeZone(mController.getTimeZone());
  formatter.applyLocalizedPattern(pattern);
  mStringBuilder.setLength(0);
  return formatter.format(mCalendar.getTime());
}

代码示例来源:origin: pentaho/pentaho-reporting

/**
 * defines the localized formatString for this SimpleDateFormat.
 *
 * @param format
 *          the formatString
 * @throws IllegalArgumentException
 *           if the string is invalid
 */
public void setLocalizedFormatString( final String format ) {
 getSimpleDateFormat().applyLocalizedPattern( format );
 invalidateCache();
}

代码示例来源:origin: EvoSuite/evosuite

public void applyLocalizedPattern(String pattern) {
  Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_TEXT_SIMPLEDATEFORMAT, this, "applyLocalizedPattern", "(Ljava/lang/String;)V", new Object[] {});
  super.applyLocalizedPattern(pattern);
  Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_TEXT_SIMPLEDATEFORMAT, this, CaptureLog.RETURN_TYPE_VOID);		
}

代码示例来源:origin: alhazmy13/HijriDatePicker

@NonNull
private String getMonthAndYearString() {
  Locale locale = mController.getLocale();
  String pattern = "MMMM yyyy";
  if (Build.VERSION.SDK_INT < 18)
    pattern = getContext().getResources().getString(R.string.mdtp_date_v1_monthyear);
  else pattern = DateFormat.getBestDateTimePattern(locale, pattern);
  SimpleDateFormat formatter = new SimpleDateFormat(pattern, locale);
  formatter.setTimeZone(mController.getTimeZone());
  formatter.applyLocalizedPattern(pattern);
  mStringBuilder.setLength(0);
  return mCalendar.getDisplayName(Calendar.MONTH, Calendar.LONG, locale) + " " + mCalendar.get(Calendar.YEAR);
}

代码示例来源:origin: jfree/jcommon

/**
 * Creates an object based on this description.
 *
 * @return The object.
 */
public Object createObject() {
  final SimpleDateFormat format = (SimpleDateFormat) super.createObject();
  if (getParameter("pattern") != null) {
    format.applyPattern((String) getParameter("pattern"));
  }
  if (getParameter("localizedPattern") != null) {
    format.applyLocalizedPattern((String) getParameter("localizedPattern"));
  }
  return format;
}

相关文章

SimpleDateFormat类方法