java.text.DateFormat.setNumberFormat()方法的使用及代码示例

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

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

DateFormat.setNumberFormat介绍

[英]Sets the NumberFormat used by this date format.
[中]设置此日期格式使用的数字格式。

代码示例

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

localSimpleDateFormat.get().setNumberFormat(newNumberFormat);

代码示例来源:origin: org.apache.velocity.tools/velocity-tools-generic

@Override
public void setNumberFormat(NumberFormat newNumberFormat)
{
  super.setNumberFormat(newNumberFormat);
  wrappedFormat.setNumberFormat(newNumberFormat);
}

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

/**
 * Sets the number formatter.
 * @param newNumberFormat the given new NumberFormat.
 * @stable ICU 2.0
 */
public void setNumberFormat(NumberFormat newNumberFormat)
{
  dateFormat.setNumberFormat(newNumberFormat.numberFormat);
}

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

/**
 * Sets the number formatter.
 * @param newNumberFormat the given new NumberFormat.
 * @stable ICU 2.0
 */
public void setNumberFormat(NumberFormat newNumberFormat)
{
  dateFormat.setNumberFormat(newNumberFormat.numberFormat);
}

代码示例来源:origin: com.jgoodies/jgoodies-common

@Override
public void setNumberFormat(NumberFormat newNumberFormat) {
  delegate.setNumberFormat(newNumberFormat);
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public void setNumberFormat(final NumberFormat newNumberFormat)
{
  delegate.get().setNumberFormat(newNumberFormat);
}

代码示例来源:origin: com.github.XDean/Java-EX

@Override
public void setNumberFormat(NumberFormat newNumberFormat) {
 get().setNumberFormat(newNumberFormat);
}

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

Locale hindi = new Locale("hi", "IN");

DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(hindi);
char required = '०'; // copied from your comment
DecimalFormat numberFormat = new DecimalFormat();
dfs.setZeroDigit(required); // or any other zero digit like '0'
numberFormat.setDecimalFormatSymbols(dfs);

SimpleDateFormat sdf = new SimpleDateFormat("MMMM dd yyyy", hindi);
sdf.setNumberFormat(numberFormat);
System.out.println("SimpleDateFormat: " + sdf.format(new Date())); // सितंबर २३ २०१६

代码示例来源:origin: org.randombits.supplier/supplier-core

/**
   * Returns a {@link DateFormat} based on the specified pattern, using the provided time zone and locale.
   *
   * @param pattern  The pattern.
   * @param timeZone The time zone
   * @param locale   The locale
   * @return the new {@link DateFormat}.
   */
  private static DateFormat getDateFormat( String pattern, TimeZone timeZone, Locale locale ) {
    DateFormat format = new SimpleDateFormat( pattern );
    format.setTimeZone( timeZone );

    Calendar calendar = Calendar.getInstance();
    calendar.setMinimalDaysInFirstWeek(4);
    format.setCalendar(calendar);

    NumberFormat numberFormat = locale == null ? NumberFormat.getInstance() : NumberFormat.getInstance( locale );
    format.setNumberFormat( numberFormat );
    return format;
  }
}

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

public void setNumberFormat(NumberFormat newNumberFormat)
{
  Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_TEXT_DATEFORMAT, this, "setNumberFormat", "(Ljava/text/NumberFormat;)V", new Object[] {newNumberFormat});
  super.setNumberFormat(newNumberFormat);
  Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_TEXT_DATEFORMAT, this, CaptureLog.RETURN_TYPE_VOID);
}

相关文章