java.text.SimpleDateFormat#applyLocalizedPattern ( )源码实例Demo

下面列出了java.text.SimpleDateFormat#applyLocalizedPattern ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Klyph   文件: DateUtil.java
private static String getFormattedFullDate(Date date)
{
	SimpleDateFormat dateFormat = (SimpleDateFormat) SimpleDateFormat.getDateInstance(SimpleDateFormat.FULL);
	String pattern = dateFormat.toLocalizedPattern();

	pattern = pattern.replace("E", "");
	pattern = pattern.replace(",", "");
	pattern = pattern.replace("  ", " ");
	pattern = pattern.trim();
	
	dateFormat.applyLocalizedPattern(pattern);

	return dateFormat.format(date);
}
 
源代码2 项目: nebula   文件: DayEditor.java
/**
 * (non-API) Method initializeColumnHeaders. Called internally when the column
 * header text needs to be updated.
 *
 * @param columns
 *            A LinkedList of CLabels representing the column objects
 */
protected void refreshColumnHeaders(LinkedList<CLabel> columns) {
	Date startDate = getStartDate();
	GregorianCalendar gc = new GregorianCalendar();
	gc.setTime(startDate);

	SimpleDateFormat formatter = new SimpleDateFormat("EE, MMM d");
	formatter.applyLocalizedPattern(formatter.toLocalizedPattern());

	for (Iterator<CLabel> iter = columns.iterator(); iter.hasNext();) {
		CLabel headerLabel = iter.next();
		headerLabel.setText(formatter.format(gc.getTime()));
		gc.add(Calendar.DATE, 1);
	}
}
 
源代码3 项目: Klyph   文件: DateUtil.java
private static SimpleDateFormat getDateFormat()
{
	SimpleDateFormat dateFormat = (SimpleDateFormat) SimpleDateFormat.getDateInstance(SimpleDateFormat.FULL);
	String pattern = dateFormat.toLocalizedPattern();

	pattern = pattern.replace("y", "");
	pattern = pattern.replace("E", "");
	pattern = pattern.replace(",", "");
	pattern = pattern.replace("  ", " ");
	pattern = pattern.trim();

	dateFormat.applyLocalizedPattern(pattern);

	return dateFormat;
}
 
/**
 * 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;
}
 
源代码5 项目: talk-android   文件: DateUtil.java
public static String formatLocale(Date date, String format) {
    String result = "";
    if (date != null) {
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
        dateFormat.applyLocalizedPattern(format);

        try {
            result = dateFormat.format(date);
        } catch (Exception e) {
            e.printStackTrace();
            return result;
        }
    }
    return result;
}
 
源代码6 项目: jasperreports   文件: JRDateLocaleConverter.java
@Override
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);
}
 
源代码7 项目: AlarmOn   文件: MonthView.java
@NonNull
private String getMonthAndYearString() {
    Locale locale = Locale.getDefault();
    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.applyLocalizedPattern(pattern);
    mStringBuilder.setLength(0);
    return formatter.format(mCalendar.getTime());
}
 
源代码8 项目: dragonwell8_jdk   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}
 
源代码9 项目: TencentKona-8   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}
 
源代码10 项目: jdk8u60   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}
 
源代码11 项目: openjdk-jdk8u   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}
 
源代码12 项目: openjdk-jdk8u-backup   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}
 
源代码13 项目: openjdk-jdk9   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}
 
源代码14 项目: jdk8u-jdk   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}
 
源代码15 项目: hottub   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}
 
源代码16 项目: openjdk-8-source   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}
 
源代码17 项目: openjdk-8   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}
 
源代码18 项目: jdk8u_jdk   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}
 
源代码19 项目: jdk8u-jdk   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}
 
源代码20 项目: jdk8u-dev-jdk   文件: Bug4994312.java
public static void main(String args[]) {
  SimpleDateFormat df = (SimpleDateFormat)
    DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.GERMAN);
  df.applyLocalizedPattern("tt.MM.uuuu");
  System.out.println(df.format(new Date()));
}