当前位置: 首页>>代码示例>>Java>>正文


Java DateFormat.SHORT属性代码示例

本文整理汇总了Java中com.ibm.icu.text.DateFormat.SHORT属性的典型用法代码示例。如果您正苦于以下问题:Java DateFormat.SHORT属性的具体用法?Java DateFormat.SHORT怎么用?Java DateFormat.SHORT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.ibm.icu.text.DateFormat的用法示例。


在下文中一共展示了DateFormat.SHORT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getJavaType

/**
 * 
 * @return
 * @throws UndefinedValueException
 */
private final int getJavaType( ) throws ChartException
{
	switch ( getType( ).getValue( ) )
	{
		case DateFormatType.SHORT :
			return DateFormat.SHORT;
		case DateFormatType.MEDIUM :
			return DateFormat.MEDIUM;
		case DateFormatType.LONG :
			return DateFormat.LONG;
		case DateFormatType.FULL :
			return DateFormat.FULL;
	}
	return 0;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:20,代码来源:DateFormatSpecifierImpl.java

示例2: initializeCombinedFormat

private MessageFormat initializeCombinedFormat(Calendar cal, ULocale locale) {
    String pattern;
    ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(
        ICUData.ICU_BASE_NAME, locale);
    String resourcePath = "calendar/" + cal.getType() + "/DateTimePatterns";
    ICUResourceBundle patternsRb= rb.findWithFallback(resourcePath);
    if (patternsRb == null && !cal.getType().equals("gregorian")) {
        // Try again with gregorian, if not already attempted.
        patternsRb = rb.findWithFallback("calendar/gregorian/DateTimePatterns");
    }

    if (patternsRb == null || patternsRb.getSize() < 9) {
        // Undefined or too few elements.
        pattern = "{1} {0}";
    } else {
        int glueIndex = 8;
        if (patternsRb.getSize() >= 13) {
          if (fDateStyle >= DateFormat.FULL && fDateStyle <= DateFormat.SHORT) {
              glueIndex += fDateStyle + 1;
          } else
              if (fDateStyle >= DateFormat.RELATIVE_FULL &&
                  fDateStyle <= DateFormat.RELATIVE_SHORT) {
                  glueIndex += fDateStyle + 1 - DateFormat.RELATIVE;
              }
        }
        int elementType = patternsRb.get(glueIndex).getType();
        if (elementType == UResourceBundle.ARRAY) {
            pattern = patternsRb.get(glueIndex).getString(0);
        } else {
            pattern = patternsRb.getString(glueIndex);
        }
    }
    combinedFormatHasDateAtStart = pattern.startsWith("{1}");
    fCombinedFormat = new MessageFormat(pattern, locale);
    return fCombinedFormat;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:36,代码来源:RelativeDateFormat.java

示例3: transTimeFormat

private int transTimeFormat(final int timeFormat) {
	if (timeFormat == TIMEFORMAT_MEDIUM)
		return DateFormat.MEDIUM;
	if (timeFormat == TIMEFORMAT_SHORT)
		return DateFormat.SHORT;
	return DateFormat.LONG;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:7,代码来源:FormatterImpl.java

示例4: formatHelper

static private DateFormat formatHelper(Calendar cal, ULocale loc, int dateStyle,
        int timeStyle) {
    if (timeStyle < DateFormat.NONE || timeStyle > DateFormat.SHORT) {
        throw new IllegalArgumentException("Illegal time style " + timeStyle);
    }
    if (dateStyle < DateFormat.NONE || dateStyle > DateFormat.SHORT) {
        throw new IllegalArgumentException("Illegal date style " + dateStyle);
    }

    PatternData patternData = PatternData.make(cal, loc);
    String override = null;

    // Resolve a pattern for the date/time style
    String pattern = null;
    if ((timeStyle >= 0) && (dateStyle >= 0)) {
        pattern = SimpleFormatterImpl.formatRawPattern(
                patternData.getDateTimePattern(dateStyle), 2, 2,
                patternData.patterns[timeStyle],
                patternData.patterns[dateStyle + 4]);
        // Might need to merge the overrides from the date and time into a single
        // override string TODO: Right now we are forcing the date's override into the
        // time style.
        if ( patternData.overrides != null ) {
            String dateOverride = patternData.overrides[dateStyle + 4];
            String timeOverride = patternData.overrides[timeStyle];
            override = mergeOverrideStrings(
                    patternData.patterns[dateStyle+4],
                    patternData.patterns[timeStyle],
                    dateOverride, timeOverride);
        }
    } else if (timeStyle >= 0) {
        pattern = patternData.patterns[timeStyle];
        if ( patternData.overrides != null ) {
            override = patternData.overrides[timeStyle];
        }
    } else if (dateStyle >= 0) {
        pattern = patternData.patterns[dateStyle + 4];
        if ( patternData.overrides != null ) {
            override = patternData.overrides[dateStyle + 4];
        }
    } else {
        throw new IllegalArgumentException("No date or time style specified");
    }
    DateFormat result = cal.handleGetDateFormat(pattern, override, loc);
    result.setCalendar(cal);
    return result;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:47,代码来源:Calendar.java


注:本文中的com.ibm.icu.text.DateFormat.SHORT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。