Example usage for com.google.gwt.i18n.shared DateTimeFormatInfo formatDay

List of usage examples for com.google.gwt.i18n.shared DateTimeFormatInfo formatDay

Introduction

In this page you can find the example usage for com.google.gwt.i18n.shared DateTimeFormatInfo formatDay.

Prototype

String formatDay();

Source Link

Document

Returns localized format equivalent to the "d" skeleton pattern.

Usage

From source file:com.rnb.plategka.shared.DateTimeFormat.java

License:Apache License

/**
 * Get a DateTimeFormat instance for a predefined format.
 * // w  ww.jav a2  s  .  c o  m
 * <p>
 * See {@link CustomDateTimeFormat} if you need a localized format that is
 * not supported here.
 * 
 * @param predef
 *            {@link PredefinedFormat} describing desired format
 * @return a DateTimeFormat instance for the specified format
 */
public static DateTimeFormat getFormat(PredefinedFormat predef) {
    if (usesFixedEnglishStrings(predef)) {
        String pattern;
        switch (predef) {
        case RFC_2822:
            pattern = RFC2822_PATTERN;
            break;
        case ISO_8601:
            pattern = ISO8601_PATTERN;
            break;
        default:
            throw new IllegalStateException("Unexpected predef type " + predef);
        }
        return getFormat(pattern, new DefaultDateTimeFormatInfo());
    }
    DateTimeFormatInfo dtfi = getDefaultDateTimeFormatInfo();
    String pattern;
    switch (predef) {
    case DATE_FULL:
        pattern = dtfi.dateFormatFull();
        break;
    case DATE_LONG:
        pattern = dtfi.dateFormatLong();
        break;
    case DATE_MEDIUM:
        pattern = dtfi.dateFormatMedium();
        break;
    case DATE_SHORT:
        pattern = dtfi.dateFormatShort();
        break;
    case DATE_TIME_FULL:
        pattern = dtfi.dateTimeFull(dtfi.timeFormatFull(), dtfi.dateFormatFull());
        break;
    case DATE_TIME_LONG:
        pattern = dtfi.dateTimeLong(dtfi.timeFormatLong(), dtfi.dateFormatLong());
        break;
    case DATE_TIME_MEDIUM:
        pattern = dtfi.dateTimeMedium(dtfi.timeFormatMedium(), dtfi.dateFormatMedium());
        break;
    case DATE_TIME_SHORT:
        pattern = dtfi.dateTimeShort(dtfi.timeFormatShort(), dtfi.dateFormatShort());
        break;
    case DAY:
        pattern = dtfi.formatDay();
        break;
    case HOUR24_MINUTE:
        pattern = dtfi.formatHour24Minute();
        break;
    case HOUR24_MINUTE_SECOND:
        pattern = dtfi.formatHour24MinuteSecond();
        break;
    case HOUR_MINUTE:
        pattern = dtfi.formatHour12Minute();
        break;
    case HOUR_MINUTE_SECOND:
        pattern = dtfi.formatHour12MinuteSecond();
        break;
    case MINUTE_SECOND:
        pattern = dtfi.formatMinuteSecond();
        break;
    case MONTH:
        pattern = dtfi.formatMonthFull();
        break;
    case MONTH_ABBR:
        pattern = dtfi.formatMonthAbbrev();
        break;
    case MONTH_ABBR_DAY:
        pattern = dtfi.formatMonthAbbrevDay();
        break;
    case MONTH_DAY:
        pattern = dtfi.formatMonthFullDay();
        break;
    case MONTH_NUM_DAY:
        pattern = dtfi.formatMonthNumDay();
        break;
    case MONTH_WEEKDAY_DAY:
        pattern = dtfi.formatMonthFullWeekdayDay();
        break;
    case TIME_FULL:
        pattern = dtfi.timeFormatFull();
        break;
    case TIME_LONG:
        pattern = dtfi.timeFormatLong();
        break;
    case TIME_MEDIUM:
        pattern = dtfi.timeFormatMedium();
        break;
    case TIME_SHORT:
        pattern = dtfi.timeFormatShort();
        break;
    case YEAR:
        pattern = dtfi.formatYear();
        break;
    case YEAR_MONTH:
        pattern = dtfi.formatYearMonthFull();
        break;
    case YEAR_MONTH_ABBR:
        pattern = dtfi.formatYearMonthAbbrev();
        break;
    case YEAR_MONTH_ABBR_DAY:
        pattern = dtfi.formatYearMonthAbbrevDay();
        break;
    case YEAR_MONTH_DAY:
        pattern = dtfi.formatYearMonthFullDay();
        break;
    case YEAR_MONTH_NUM:
        pattern = dtfi.formatYearMonthNum();
        break;
    case YEAR_MONTH_NUM_DAY:
        pattern = dtfi.formatYearMonthNumDay();
        break;
    case YEAR_MONTH_WEEKDAY_DAY:
        pattern = dtfi.formatYearMonthWeekdayDay();
        break;
    case YEAR_QUARTER:
        pattern = dtfi.formatYearQuarterFull();
        break;
    case YEAR_QUARTER_ABBR:
        pattern = dtfi.formatYearQuarterShort();
        break;
    default:
        throw new IllegalArgumentException("Unexpected predefined format " + predef);
    }
    return getFormat(pattern, dtfi);
}

From source file:edu.stanford.isis.epad.plugin.lesiontracking.shared.DateTimeFormat.java

License:Apache License

/**
 * Get a DateTimeFormat instance for a predefined format.
 *
 * <p>See {@link CustomDateTimeFormat} if you need a localized format that is
 * not supported here.//from  w  w  w .  j  a va  2s .  com
 *
 * @param predef {@link PredefinedFormat} describing desired format
 * @return a DateTimeFormat instance for the specified format
 */
public static DateTimeFormat getFormat(PredefinedFormat predef) {
    if (usesFixedEnglishStrings(predef)) {
        String pattern;
        switch (predef) {
        case RFC_2822:
            pattern = com.google.gwt.i18n.shared.DateTimeFormat.RFC2822_PATTERN;
            break;
        case ISO_8601:
            pattern = com.google.gwt.i18n.shared.DateTimeFormat.ISO8601_PATTERN;
            break;
        default:
            throw new IllegalStateException("Unexpected predef type " + predef);
        }
        return getFormat(pattern, new DateTimeFormatInfoImpl_en()); //removed when moved from 2.5.1 to 2.2.0
        //return getFormat(pattern);
    }
    DateTimeFormatInfo dtfi = getDefaultDateTimeFormatInfo();
    String pattern;
    switch (predef) {
    case DATE_FULL:
        pattern = dtfi.dateFormatFull();
        break;
    case DATE_LONG:
        pattern = dtfi.dateFormatLong();
        break;
    case DATE_MEDIUM:
        pattern = dtfi.dateFormatMedium();
        break;
    case DATE_SHORT:
        pattern = dtfi.dateFormatShort();
        break;
    case DATE_TIME_FULL:
        pattern = dtfi.dateTimeFull(dtfi.timeFormatFull(), dtfi.dateFormatFull());
        break;
    case DATE_TIME_LONG:
        pattern = dtfi.dateTimeLong(dtfi.timeFormatLong(), dtfi.dateFormatLong());
        break;
    case DATE_TIME_MEDIUM:
        pattern = dtfi.dateTimeMedium(dtfi.timeFormatMedium(), dtfi.dateFormatMedium());
        break;
    case DATE_TIME_SHORT:
        pattern = dtfi.dateTimeShort(dtfi.timeFormatShort(), dtfi.dateFormatShort());
        break;
    case DAY:
        pattern = dtfi.formatDay();
        break;
    case HOUR24_MINUTE:
        pattern = dtfi.formatHour24Minute();
        break;
    case HOUR24_MINUTE_SECOND:
        pattern = dtfi.formatHour24MinuteSecond();
        break;
    case HOUR_MINUTE:
        pattern = dtfi.formatHour12Minute();
        break;
    case HOUR_MINUTE_SECOND:
        pattern = dtfi.formatHour12MinuteSecond();
        break;
    case MINUTE_SECOND:
        pattern = dtfi.formatMinuteSecond();
        break;
    case MONTH:
        pattern = dtfi.formatMonthFull();
        break;
    case MONTH_ABBR:
        pattern = dtfi.formatMonthAbbrev();
        break;
    case MONTH_ABBR_DAY:
        pattern = dtfi.formatMonthAbbrevDay();
        break;
    case MONTH_DAY:
        pattern = dtfi.formatMonthFullDay();
        break;
    case MONTH_NUM_DAY:
        pattern = dtfi.formatMonthNumDay();
        break;
    case MONTH_WEEKDAY_DAY:
        pattern = dtfi.formatMonthFullWeekdayDay();
        break;
    case TIME_FULL:
        pattern = dtfi.timeFormatFull();
        break;
    case TIME_LONG:
        pattern = dtfi.timeFormatLong();
        break;
    case TIME_MEDIUM:
        pattern = dtfi.timeFormatMedium();
        break;
    case TIME_SHORT:
        pattern = dtfi.timeFormatShort();
        break;
    case YEAR:
        pattern = dtfi.formatYear();
        break;
    case YEAR_MONTH:
        pattern = dtfi.formatYearMonthFull();
        break;
    case YEAR_MONTH_ABBR:
        pattern = dtfi.formatYearMonthAbbrev();
        break;
    case YEAR_MONTH_ABBR_DAY:
        pattern = dtfi.formatYearMonthAbbrevDay();
        break;
    case YEAR_MONTH_DAY:
        pattern = dtfi.formatYearMonthFullDay();
        break;
    case YEAR_MONTH_NUM:
        pattern = dtfi.formatYearMonthNum();
        break;
    case YEAR_MONTH_NUM_DAY:
        pattern = dtfi.formatYearMonthNumDay();
        break;
    case YEAR_MONTH_WEEKDAY_DAY:
        pattern = dtfi.formatYearMonthWeekdayDay();
        break;
    case YEAR_QUARTER:
        pattern = dtfi.formatYearQuarterFull();
        break;
    case YEAR_QUARTER_ABBR:
        pattern = dtfi.formatYearQuarterShort();
        break;
    default:
        throw new IllegalArgumentException("Unexpected predefined format " + predef);
    }
    return getFormat(pattern, dtfi);
}

From source file:io.pelle.mango.client.core.utils.DateTimeFormat.java

License:Apache License

/**
 * Get a DateTimeFormat instance for a predefined format.
 * //from  w  w w . j a v a 2  s . c o  m
 * <p>
 * See {@link CustomDateTimeFormat} if you need a localized format that is
 * not supported here.
 * 
 * @param predef
 *            {@link PredefinedFormat} describing desired format
 * @return a DateTimeFormat instance for the specified format
 */
public static com.google.gwt.i18n.shared.DateTimeFormat getFormat(PredefinedFormat predef) {
    if (usesFixedEnglishStrings(predef)) {
        String pattern;
        switch (predef) {
        case RFC_2822:
            pattern = com.google.gwt.i18n.shared.DateTimeFormat.RFC2822_PATTERN;
            break;
        case ISO_8601:
            pattern = com.google.gwt.i18n.shared.DateTimeFormat.ISO8601_PATTERN;
            break;
        default:
            throw new IllegalStateException("Unexpected predef type " + predef);
        }
        return getFormat(pattern, new DateTimeFormatInfoImpl_en());
    }
    DateTimeFormatInfo dtfi = getDefaultDateTimeFormatInfo();
    String pattern;
    switch (predef) {
    case DATE_FULL:
        pattern = dtfi.dateFormatFull();
        break;
    case DATE_LONG:
        pattern = dtfi.dateFormatLong();
        break;
    case DATE_MEDIUM:
        pattern = dtfi.dateFormatMedium();
        break;
    case DATE_SHORT:
        pattern = dtfi.dateFormatShort();
        break;
    case DATE_TIME_FULL:
        pattern = dtfi.dateTimeFull(dtfi.timeFormatFull(), dtfi.dateFormatFull());
        break;
    case DATE_TIME_LONG:
        pattern = dtfi.dateTimeLong(dtfi.timeFormatLong(), dtfi.dateFormatLong());
        break;
    case DATE_TIME_MEDIUM:
        pattern = dtfi.dateTimeMedium(dtfi.timeFormatMedium(), dtfi.dateFormatMedium());
        break;
    case DATE_TIME_SHORT:
        pattern = dtfi.dateTimeShort(dtfi.timeFormatShort(), dtfi.dateFormatShort());
        break;
    case DAY:
        pattern = dtfi.formatDay();
        break;
    case HOUR24_MINUTE:
        pattern = dtfi.formatHour24Minute();
        break;
    case HOUR24_MINUTE_SECOND:
        pattern = dtfi.formatHour24MinuteSecond();
        break;
    case HOUR_MINUTE:
        pattern = dtfi.formatHour12Minute();
        break;
    case HOUR_MINUTE_SECOND:
        pattern = dtfi.formatHour12MinuteSecond();
        break;
    case MINUTE_SECOND:
        pattern = dtfi.formatMinuteSecond();
        break;
    case MONTH:
        pattern = dtfi.formatMonthFull();
        break;
    case MONTH_ABBR:
        pattern = dtfi.formatMonthAbbrev();
        break;
    case MONTH_ABBR_DAY:
        pattern = dtfi.formatMonthAbbrevDay();
        break;
    case MONTH_DAY:
        pattern = dtfi.formatMonthFullDay();
        break;
    case MONTH_NUM_DAY:
        pattern = dtfi.formatMonthNumDay();
        break;
    case MONTH_WEEKDAY_DAY:
        pattern = dtfi.formatMonthFullWeekdayDay();
        break;
    case TIME_FULL:
        pattern = dtfi.timeFormatFull();
        break;
    case TIME_LONG:
        pattern = dtfi.timeFormatLong();
        break;
    case TIME_MEDIUM:
        pattern = dtfi.timeFormatMedium();
        break;
    case TIME_SHORT:
        pattern = dtfi.timeFormatShort();
        break;
    case YEAR:
        pattern = dtfi.formatYear();
        break;
    case YEAR_MONTH:
        pattern = dtfi.formatYearMonthFull();
        break;
    case YEAR_MONTH_ABBR:
        pattern = dtfi.formatYearMonthAbbrev();
        break;
    case YEAR_MONTH_ABBR_DAY:
        pattern = dtfi.formatYearMonthAbbrevDay();
        break;
    case YEAR_MONTH_DAY:
        pattern = dtfi.formatYearMonthFullDay();
        break;
    case YEAR_MONTH_NUM:
        pattern = dtfi.formatYearMonthNum();
        break;
    case YEAR_MONTH_NUM_DAY:
        pattern = dtfi.formatYearMonthNumDay();
        break;
    case YEAR_MONTH_WEEKDAY_DAY:
        pattern = dtfi.formatYearMonthWeekdayDay();
        break;
    case YEAR_QUARTER:
        pattern = dtfi.formatYearQuarterFull();
        break;
    case YEAR_QUARTER_ABBR:
        pattern = dtfi.formatYearQuarterShort();
        break;
    default:
        throw new IllegalArgumentException("Unexpected predefined format " + predef);
    }
    return getFormat(pattern, dtfi);
}