Package org.teavm.classlib.impl.unicode

Examples of org.teavm.classlib.impl.unicode.DateFormatCollection


    public static TDateFormat getDateInstance(int style, TLocale locale) {
        return new TSimpleDateFormat(getDateFormatString(style, locale), locale);
    }

    private static String getDateFormatString(int style, TLocale locale) {
        DateFormatCollection formats = CLDRHelper.resolveDateFormats(locale.getLanguage(), locale.getCountry());
        switch (style) {
            case SHORT:
                return formats.getShortFormat();
            case MEDIUM:
                return formats.getMediumFormat();
            case LONG:
                return formats.getLongFormat();
            case FULL:
                return formats.getFullFormat();
            default:
                throw new IllegalArgumentException("Unknown style: " + style);
        }
    }
View Full Code Here


                .replace("{1}", getDateFormatString(timeStyle, locale));
        return new TSimpleDateFormat(pattern, locale);
    }

    public static String getDateTimeFormatString(int style, TLocale locale) {
        DateFormatCollection formats = CLDRHelper.resolveDateTimeFormats(locale.getLanguage(), locale.getCountry());
        switch (style) {
            case SHORT:
                return formats.getShortFormat();
            case MEDIUM:
                return formats.getMediumFormat();
            case LONG:
                return formats.getLongFormat();
            case FULL:
                return formats.getFullFormat();
            default:
                throw new IllegalArgumentException("Unknown style: " + style);
        }
    }
View Full Code Here

    public static TDateFormat getTimeInstance(int style, TLocale locale) {
        return new TSimpleDateFormat(getTimeFormatString(style, locale), locale);
    }

    private static String getTimeFormatString(int style, TLocale locale) {
        DateFormatCollection formats = CLDRHelper.resolveTimeFormats(locale.getLanguage(), locale.getCountry());
        switch (style) {
            case SHORT:
                return formats.getShortFormat();
            case MEDIUM:
                return formats.getMediumFormat();
            case LONG:
                return formats.getLongFormat();
            case FULL:
                return formats.getFullFormat();
            default:
                throw new IllegalArgumentException("Unknown style: " + style);
        }
    }
View Full Code Here

TOP

Related Classes of org.teavm.classlib.impl.unicode.DateFormatCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.