org.joda.time.format.DateTimeFormatter.withPivotYear()方法的使用及代码示例

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

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

DateTimeFormatter.withPivotYear介绍

[英]Returns a new formatter that will use the specified pivot year for two digit year parsing in preference to that stored in the parser.

This setting is useful for changing the pivot year of formats built using a pattern - DateTimeFormat#forPattern(String).

When parsing, this pivot year is used. There is no effect when printing.

The pivot year enables a two digit year to be converted to a four digit year. The pivot represents the year in the middle of the supported range of years. Thus the full range of years that will be built is (pivot - 50) .. (pivot + 49).

pivot   supported range   00 is   20 is   40 is   60 is   80 is 
--------------------------------------------------------------- 
1950      1900..1999      1900    1920    1940    1960    1980 
1975      1925..2024      2000    2020    1940    1960    1980 
2000      1950..2049      2000    2020    2040    1960    1980 
2025      1975..2074      2000    2020    2040    2060    1980 
2050      2000..2099      2000    2020    2040    2060    2080

[中]返回一个新的格式化程序,该格式化程序将使用指定的透视年进行两位数的年份解析,优先于解析器中存储的年份解析。
此设置对于更改使用模式DateTimeFormat#forPattern(字符串)构建的格式的透视年非常有用。
解析时,使用此透视年。打印时没有效果。
轴心年允许将两位数的年份转换为四位数的年份。枢轴代表年在支持的范围内的年份。因此,将建造的全部年份为(pivot - 50) .. (pivot + 49)

pivot   supported range   00 is   20 is   40 is   60 is   80 is 
--------------------------------------------------------------- 
1950      1900..1999      1900    1920    1940    1960    1980 
1975      1925..2024      2000    2020    1940    1960    1980 
2000      1950..2049      2000    2020    2040    1960    1980 
2025      1975..2074      2000    2020    2040    2060    1980 
2050      2000..2099      2000    2020    2040    2060    2080

代码示例

代码示例来源:origin: joda-time/joda-time

return withPivotYear(Integer.valueOf(pivotYear));

代码示例来源:origin: JodaOrg/joda-time

return withPivotYear(Integer.valueOf(pivotYear));

代码示例来源:origin: camunda/camunda-bpm-platform

return withPivotYear(Integer.valueOf(pivotYear));

代码示例来源:origin: org.joda/com.springsource.org.joda.time

return withPivotYear(new Integer(pivotYear));

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

return withPivotYear(Integer.valueOf(pivotYear));

代码示例来源:origin: io.virtdata/virtdata-lib-realer

return withPivotYear(Integer.valueOf(pivotYear));

代码示例来源:origin: Nextdoor/bender

return withPivotYear(Integer.valueOf(pivotYear));

代码示例来源:origin: org.wicketstuff/wicketstuff-datetime-yui

/**
   * @return formatter The formatter for the current conversion
   */
  @Override
  protected DateTimeFormatter getFormat(Locale locale)
  {
    return DateTimeFormat.forPattern(datePattern).withLocale(locale).withPivotYear(2000);
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

return withPivotYear(Integer.valueOf(pivotYear));

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

return withPivotYear(Integer.valueOf(pivotYear));

代码示例来源:origin: redfish64/TinyTravelTracker

return withPivotYear(Integer.valueOf(pivotYear));

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time

return withPivotYear(Integer.valueOf(pivotYear));

代码示例来源:origin: org.apache.wicket/wicket-datetime

/**
   * @return formatter The formatter for the current conversion
   */
  @Override
  protected DateTimeFormatter getFormat(Locale locale)
  {
    return DateTimeFormat.forPattern(datePattern).withLocale(locale).withPivotYear(2000);
  }
}

代码示例来源:origin: org.wicketstuff/wicketstuff-datetime-yui

/**
   * @return formatter The formatter for the current conversion
   */
  @Override
  protected DateTimeFormatter getFormat(Locale locale)
  {
    return DateTimeFormat.forPattern(getDatePattern(locale))
      .withLocale(locale)
      .withPivotYear(2000);
  }
}

代码示例来源:origin: micromata/projectforge

protected DateTimeFormatter getDateTimeFormatter(final String pattern, final Locale locale)
{
 return DateTimeFormat.forPattern(pattern).withLocale(locale).withZone(timeZone).withPivotYear(PIVOT_YEAR).withDefaultYear(currentYear);
}

代码示例来源:origin: org.apache.wicket/wicket-datetime

/**
   * @return formatter The formatter for the current conversion
   */
  @Override
  protected DateTimeFormatter getFormat(Locale locale)
  {
    return DateTimeFormat.forPattern(getDatePattern(locale))
      .withLocale(locale)
      .withPivotYear(2000);
  }
}

代码示例来源:origin: micromata/projectforge

@Override
protected DateTimeFormatter getFormat(final Locale locale)
{
 final DateTimeFormatter dtf = DateTimeFormat.forPattern(getDatePattern(locale)).withLocale(locale).withPivotYear(2000);
 return dtf;
}

代码示例来源:origin: Alfresco/alfresco-repository

DateTimeFormatter dateTimeFormater = DateTimeFormat.forPattern(format).withPivotYear(2000);
DateTime dateTime = null;
try

相关文章