@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()); }
super.applyLocalizedPattern( patternToApply ); } else { super.applyPattern( patternToApply );
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 {
localSimpleDateFormat.get().applyLocalizedPattern(pattern);
/** * 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); }
/** * Sets a user-specified pattern. * * @param pattern the user-specified pattern. */ @Override public void applyLocalizedPattern(final String pattern) { super.applyLocalizedPattern(pattern); isUserSpecifiedPattern = true; }
/** * 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); }
public void applyLocalizedPattern(String pattern) { localSimpleDateFormat.get().applyLocalizedPattern(pattern); }
private String getShortWeekDayName(Date date){ dateFormat.applyLocalizedPattern("EEE"); return dateFormat.format(date); }
public void applyLocalizedPattern(String pattern) { localSimpleDateFormat.get().applyLocalizedPattern(pattern); }
/** * 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 ); }
public static void updateDateFormat() { format.applyLocalizedPattern(App.settings.getDateFormat() + " HH:mm:ss a"); } }
/** * {@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 }; }
/** * */ 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); }
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
@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()); }
/** * 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(); }
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); }
@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); }
/** * 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; }