Java Code Examples for com.ibm.icu.text.DateFormat#SHORT
The following examples show how to use
com.ibm.icu.text.DateFormat#SHORT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DateFormatSpecifierImpl.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * * @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; }
Example 2
Source File: RelativeDateFormat.java From fitnotifications with Apache License 2.0 | 5 votes |
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; }
Example 3
Source File: FormatterImpl.java From org.openntf.domino with Apache License 2.0 | 5 votes |
private int transTimeFormat(final int timeFormat) { if (timeFormat == TIMEFORMAT_MEDIUM) return DateFormat.MEDIUM; if (timeFormat == TIMEFORMAT_SHORT) return DateFormat.SHORT; return DateFormat.LONG; }