java.time.format.DateTimeFormatter.withDecimalStyle()方法的使用及代码示例

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

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

DateTimeFormatter.withDecimalStyle介绍

[英]Returns a copy of this formatter with a new decimal style.

This instance is immutable and unaffected by this method call.
[中]使用新的十进制样式返回此格式化程序的副本。
此实例是不可变的,不受此方法调用的影响。

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

void updateWeekNumberDateCells() {
  if (datePicker.isShowWeekNumbers()) {
    final Locale locale = getLocale();
    LocalDate firstDayOfMonth = selectedYearMonth.get().atDay(1);
    for (int i = 0; i < 6; i++) {
      LocalDate date = firstDayOfMonth.plus(i, WEEKS);
      String weekNumber = weekNumberFormatter.withLocale(locale)
        .withDecimalStyle(DecimalStyle.of(locale))
        .format(date);
      weekNumberCells.get(i).setText(weekNumber);
    }
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

private String formatYear(YearMonth yearMonth) {
  try {
    Chronology chrono = getPrimaryChronology();
    ChronoLocalDate cDate = chrono.date(yearMonth.atDay(1));
    return yearFormatter.withLocale(getLocale())
      .withChronology(chrono)
      .withDecimalStyle(DecimalStyle.of(getLocale()))
      .format(cDate);
  } catch (DateTimeException ex) {
    // Date is out of range.
    return "";
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

String cellText = dayCellFormatter.withLocale(locale)
  .withChronology(chrono)
  .withDecimalStyle(DecimalStyle.of(locale))
  .format(cDate);
dayCell.setText(cellText);

代码示例来源:origin: net.sourceforge.htmlunit/htmlunit

&& !"ar-TN".equals(locale))) {
final DecimalStyle decimalStyle = DecimalStyle.STANDARD.withZeroDigit('\u0660');
formatter_ = DateTimeFormatter.ofPattern(pattern).withDecimalStyle(decimalStyle);

代码示例来源:origin: HtmlUnit/htmlunit

&& !"ar-TN".equals(locale))) {
final DecimalStyle decimalStyle = DecimalStyle.STANDARD.withZeroDigit('\u0660');
formatter_ = DateTimeFormatter.ofPattern(pattern).withDecimalStyle(decimalStyle);

代码示例来源:origin: com.jfoenix/jfoenix

void updateWeekNumberDateCells() {
  if (datePicker.isShowWeekNumbers()) {
    final Locale locale = getLocale();
    LocalDate firstDayOfMonth = selectedYearMonth.get().atDay(1);
    for (int i = 0; i < 6; i++) {
      LocalDate date = firstDayOfMonth.plus(i, WEEKS);
      String weekNumber = weekNumberFormatter.withLocale(locale)
        .withDecimalStyle(DecimalStyle.of(locale))
        .format(date);
      weekNumberCells.get(i).setText(weekNumber);
    }
  }
}

代码示例来源:origin: com.jfoenix/jfoenix

private String formatYear(YearMonth yearMonth) {
  try {
    Chronology chrono = getPrimaryChronology();
    ChronoLocalDate cDate = chrono.date(yearMonth.atDay(1));
    return yearFormatter.withLocale(getLocale())
      .withChronology(chrono)
      .withDecimalStyle(DecimalStyle.of(getLocale()))
      .format(cDate);
  } catch (DateTimeException ex) {
    // Date is out of range.
    return "";
  }
}

代码示例来源:origin: com.jfoenix/jfoenix

String cellText = dayCellFormatter.withLocale(locale)
  .withChronology(chrono)
  .withDecimalStyle(DecimalStyle.of(locale))
  .format(cDate);
dayCell.setText(cellText);

相关文章