Java Code Examples for java.text.DateFormatSymbols#getAmPmStrings()

The following examples show how to use java.text.DateFormatSymbols#getAmPmStrings() . 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: Calendar.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
    String[] strings = null;
    switch (field) {
    case ERA:
        strings = symbols.getEras();
        break;

    case MONTH:
        strings = (style == LONG) ? symbols.getMonths() : symbols.getShortMonths();
        break;

    case DAY_OF_WEEK:
        strings = (style == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
        break;

    case AM_PM:
        strings = symbols.getAmPmStrings();
        break;
    }
    return strings;
}
 
Example 2
Source File: Calendar.java    From j2objc with Apache License 2.0 6 votes vote down vote up
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
    String[] strings = null;
    switch (field) {
    case ERA:
        strings = symbols.getEras();
        break;

    case MONTH:
        strings = (style == LONG) ? symbols.getMonths() : symbols.getShortMonths();
        break;

    case DAY_OF_WEEK:
        strings = (style == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
        break;

    case AM_PM:
        strings = symbols.getAmPmStrings();
        break;
    }
    return strings;
}
 
Example 3
Source File: Calendar.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
    int baseStyle = getBaseStyle(style); // ignore the standalone mask

    // DateFormatSymbols doesn't support any narrow names.
    if (baseStyle == NARROW_FORMAT) {
        return null;
    }

    String[] strings = null;
    switch (field) {
    case ERA:
        strings = symbols.getEras();
        break;

    case MONTH:
        strings = (baseStyle == LONG) ? symbols.getMonths() : symbols.getShortMonths();
        break;

    case DAY_OF_WEEK:
        strings = (baseStyle == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
        break;

    case AM_PM:
        strings = symbols.getAmPmStrings();
        break;
    }
    return strings;
}
 
Example 4
Source File: Calendar.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
    int baseStyle = getBaseStyle(style); // ignore the standalone mask

    // DateFormatSymbols doesn't support any narrow names.
    if (baseStyle == NARROW_FORMAT) {
        return null;
    }

    String[] strings = null;
    switch (field) {
    case ERA:
        strings = symbols.getEras();
        break;

    case MONTH:
        strings = (baseStyle == LONG) ? symbols.getMonths() : symbols.getShortMonths();
        break;

    case DAY_OF_WEEK:
        strings = (baseStyle == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
        break;

    case AM_PM:
        strings = symbols.getAmPmStrings();
        break;
    }
    return strings;
}
 
Example 5
Source File: Calendar.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
    int baseStyle = getBaseStyle(style); // ignore the standalone mask

    // DateFormatSymbols doesn't support any narrow names.
    if (baseStyle == NARROW_FORMAT) {
        return null;
    }

    String[] strings = null;
    switch (field) {
    case ERA:
        strings = symbols.getEras();
        break;

    case MONTH:
        strings = (baseStyle == LONG) ? symbols.getMonths() : symbols.getShortMonths();
        break;

    case DAY_OF_WEEK:
        strings = (baseStyle == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
        break;

    case AM_PM:
        strings = symbols.getAmPmStrings();
        break;
    }
    return strings;
}
 
Example 6
Source File: Calendar.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
    int baseStyle = getBaseStyle(style); // ignore the standalone mask

    // DateFormatSymbols doesn't support any narrow names.
    if (baseStyle == NARROW_FORMAT) {
        return null;
    }

    String[] strings = null;
    switch (field) {
    case ERA:
        strings = symbols.getEras();
        break;

    case MONTH:
        strings = (baseStyle == LONG) ? symbols.getMonths() : symbols.getShortMonths();
        break;

    case DAY_OF_WEEK:
        strings = (baseStyle == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
        break;

    case AM_PM:
        strings = symbols.getAmPmStrings();
        break;
    }
    return strings;
}
 
Example 7
Source File: FastDateParser.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private static String[] getDisplayNameArray(int field, boolean isLong, Locale locale) {
    DateFormatSymbols dfs = new DateFormatSymbols(locale);
    switch (field) {
        case Calendar.AM_PM:
            return dfs.getAmPmStrings();
        case Calendar.DAY_OF_WEEK:
            return isLong ? dfs.getWeekdays() : dfs.getShortWeekdays();
        case Calendar.ERA:
            return dfs.getEras();
        case Calendar.MONTH:
            return isLong ? dfs.getMonths() : dfs.getShortMonths();
    }
    return null;
}
 
Example 8
Source File: Calendar.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
    int baseStyle = getBaseStyle(style); // ignore the standalone mask

    // DateFormatSymbols doesn't support any narrow names.
    if (baseStyle == NARROW_FORMAT) {
        return null;
    }

    String[] strings = null;
    switch (field) {
    case ERA:
        strings = symbols.getEras();
        break;

    case MONTH:
        strings = (baseStyle == LONG) ? symbols.getMonths() : symbols.getShortMonths();
        break;

    case DAY_OF_WEEK:
        strings = (baseStyle == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
        break;

    case AM_PM:
        strings = symbols.getAmPmStrings();
        break;
    }
    return strings;
}
 
Example 9
Source File: Calendar.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
    int baseStyle = getBaseStyle(style); // ignore the standalone mask

    // DateFormatSymbols doesn't support any narrow names.
    if (baseStyle == NARROW_FORMAT) {
        return null;
    }

    String[] strings = null;
    switch (field) {
    case ERA:
        strings = symbols.getEras();
        break;

    case MONTH:
        strings = (baseStyle == LONG) ? symbols.getMonths() : symbols.getShortMonths();
        break;

    case DAY_OF_WEEK:
        strings = (baseStyle == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
        break;

    case AM_PM:
        strings = symbols.getAmPmStrings();
        break;
    }
    return strings;
}
 
Example 10
Source File: Calendar.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
    int baseStyle = getBaseStyle(style); // ignore the standalone mask

    // DateFormatSymbols doesn't support any narrow names.
    if (baseStyle == NARROW_FORMAT) {
        return null;
    }

    String[] strings = null;
    switch (field) {
    case ERA:
        strings = symbols.getEras();
        break;

    case MONTH:
        strings = (baseStyle == LONG) ? symbols.getMonths() : symbols.getShortMonths();
        break;

    case DAY_OF_WEEK:
        strings = (baseStyle == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
        break;

    case AM_PM:
        strings = symbols.getAmPmStrings();
        break;
    }
    return strings;
}
 
Example 11
Source File: Calendar.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
    int baseStyle = getBaseStyle(style); // ignore the standalone mask

    // DateFormatSymbols doesn't support any narrow names.
    if (baseStyle == NARROW_FORMAT) {
        return null;
    }

    String[] strings = null;
    switch (field) {
    case ERA:
        strings = symbols.getEras();
        break;

    case MONTH:
        strings = (baseStyle == LONG) ? symbols.getMonths() : symbols.getShortMonths();
        break;

    case DAY_OF_WEEK:
        strings = (baseStyle == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
        break;

    case AM_PM:
        strings = symbols.getAmPmStrings();
        break;
    }
    return strings;
}
 
Example 12
Source File: FastDateParser.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private static String[] getDisplayNameArray(int field, boolean isLong, Locale locale) {
    DateFormatSymbols dfs = new DateFormatSymbols(locale);
    switch (field) {
        case Calendar.AM_PM:
            return dfs.getAmPmStrings();
        case Calendar.DAY_OF_WEEK:
            return isLong ? dfs.getWeekdays() : dfs.getShortWeekdays();
        case Calendar.ERA:
            return dfs.getEras();
        case Calendar.MONTH:
            return isLong ? dfs.getMonths() : dfs.getShortMonths();
    }
    return null;
}
 
Example 13
Source File: FastDateParser.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private static String[] getDisplayNameArray(int field, boolean isLong, Locale locale) {
    DateFormatSymbols dfs = new DateFormatSymbols(locale);
    switch (field) {
        case Calendar.AM_PM:
            return dfs.getAmPmStrings();
        case Calendar.DAY_OF_WEEK:
            return isLong ? dfs.getWeekdays() : dfs.getShortWeekdays();
        case Calendar.ERA:
            return dfs.getEras();
        case Calendar.MONTH:
            return isLong ? dfs.getMonths() : dfs.getShortMonths();
    }
    return null;
}
 
Example 14
Source File: LocaledDateFormat.java    From common-utils with GNU General Public License v2.0 5 votes vote down vote up
public LocaledDateFormat(Locale locale) {
    DateFormatSymbols dateFormatSymbols = new DateFormatSymbols(locale);

    months = dateFormatSymbols.getMonths();
    shortMonths = dateFormatSymbols.getShortMonths();
    weekdays = dateFormatSymbols.getWeekdays();
    shortWeekdays = dateFormatSymbols.getShortWeekdays();
    eras = dateFormatSymbols.getEras();
    ampms = dateFormatSymbols.getAmPmStrings();
}
 
Example 15
Source File: Calendar.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
    int baseStyle = getBaseStyle(style); // ignore the standalone mask

    // DateFormatSymbols doesn't support any narrow names.
    if (baseStyle == NARROW_FORMAT) {
        return null;
    }

    String[] strings = null;
    switch (field) {
    case ERA:
        strings = symbols.getEras();
        break;

    case MONTH:
        strings = (baseStyle == LONG) ? symbols.getMonths() : symbols.getShortMonths();
        break;

    case DAY_OF_WEEK:
        strings = (baseStyle == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
        break;

    case AM_PM:
        strings = symbols.getAmPmStrings();
        break;
    }
    return strings;
}
 
Example 16
Source File: DateFormatSymbolsEx.java    From web-data-extractor with Apache License 2.0 5 votes vote down vote up
public DateFormatSymbolsEx(Locale locale) {
    DateFormatSymbols dateFormatSymbols = new DateFormatSymbols(locale);

    months = dateFormatSymbols.getMonths();
    shortMonths = dateFormatSymbols.getShortMonths();
    weekdays = dateFormatSymbols.getWeekdays();
    shortWeekdays = dateFormatSymbols.getShortWeekdays();
    eras = dateFormatSymbols.getEras();
    ampms = dateFormatSymbols.getAmPmStrings();
}
 
Example 17
Source File: Calendar.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
    int baseStyle = getBaseStyle(style); // ignore the standalone mask

    // DateFormatSymbols doesn't support any narrow names.
    if (baseStyle == NARROW_FORMAT) {
        return null;
    }

    String[] strings = null;
    switch (field) {
    case ERA:
        strings = symbols.getEras();
        break;

    case MONTH:
        strings = (baseStyle == LONG) ? symbols.getMonths() : symbols.getShortMonths();
        break;

    case DAY_OF_WEEK:
        strings = (baseStyle == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
        break;

    case AM_PM:
        strings = symbols.getAmPmStrings();
        break;
    }
    return strings;
}
 
Example 18
Source File: GJLocaleSymbols.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param locale must not be null
 */
private GJLocaleSymbols(Locale locale) {
    iLocale = new WeakReference<Locale>(locale);
    
    DateFormatSymbols dfs = DateTimeUtils.getDateFormatSymbols(locale);
    
    iEras = dfs.getEras();
    iDaysOfWeek = realignDaysOfWeek(dfs.getWeekdays());
    iShortDaysOfWeek = realignDaysOfWeek(dfs.getShortWeekdays());
    iMonths = realignMonths(dfs.getMonths());
    iShortMonths = realignMonths(dfs.getShortMonths());
    iHalfday = dfs.getAmPmStrings();

    Integer[] integers = new Integer[13];
    for (int i=0; i<13; i++) {
        integers[i] = Integer.valueOf(i);
    }

    iParseEras = new TreeMap<String, Integer>(String.CASE_INSENSITIVE_ORDER);
    addSymbols(iParseEras, iEras, integers);
    if ("en".equals(locale.getLanguage())) {
        // Include support for parsing "BCE" and "CE" if the language is
        // English. At some point Joda-Time will need an independent set of
        // localized symbols and not depend on java.text.DateFormatSymbols.
        iParseEras.put("BCE", integers[0]);
        iParseEras.put("CE", integers[1]);
    }

    iParseDaysOfWeek = new TreeMap<String, Integer>(String.CASE_INSENSITIVE_ORDER);
    addSymbols(iParseDaysOfWeek, iDaysOfWeek, integers);
    addSymbols(iParseDaysOfWeek, iShortDaysOfWeek, integers);
    addNumerals(iParseDaysOfWeek, 1, 7, integers);

    iParseMonths = new TreeMap<String, Integer>(String.CASE_INSENSITIVE_ORDER);
    addSymbols(iParseMonths, iMonths, integers);
    addSymbols(iParseMonths, iShortMonths, integers);
    addNumerals(iParseMonths, 1, 12, integers);

    iMaxEraLength = maxLength(iEras);
    iMaxDayOfWeekLength = maxLength(iDaysOfWeek);
    iMaxShortDayOfWeekLength = maxLength(iShortDaysOfWeek);
    iMaxMonthLength = maxLength(iMonths);
    iMaxShortMonthLength = maxLength(iShortMonths);
    iMaxHalfdayLength = maxLength(iHalfday);
}
 
Example 19
Source File: ConfigurationBean.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
private void localizeParameters(){
	DateFormatSymbols dsf = DateFormatSymbols.getInstance(new ResourceLoader().getLocale());
	String[] amPmString = dsf.getAmPmStrings();
	capAM = amPmString[0];
	capPM = amPmString[1];
}
 
Example 20
Source File: ConfigurationBean.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
private void localizeParameters(){
	DateFormatSymbols dsf = DateFormatSymbols.getInstance(new ResourceLoader().getLocale());
	String[] amPmString = dsf.getAmPmStrings();
	capAM = amPmString[0];
	capPM = amPmString[1];
}