APISonar


android.icu.util.Calendar.DATE

> android > icu > util > Calendar > DATE
android APIs icu APIs util APIs Calendar APIs DATE APIs

Example 1
public void TestSetIntervalPatternNoSideEffect() {
        PatternInfo patternInfo = new DateIntervalInfo(ULocale.ENGLISH).getIntervalPattern("yMd", Calendar.DATE);
        String expectedPattern = patternInfo.getFirstPart() + patternInfo.getSecondPart();
        new DateIntervalInfo(ULocale.ENGLISH).setIntervalPattern(
                "yMd", Calendar.DATE, "M/d/y \u2013 d");
        patternInfo = new DateIntervalInfo(ULocale.ENGLISH).getIntervalPattern("yMd", Calendar.DATE);
        String actualPattern = patternInfo.getFirstPart() + patternInfo.getSecondPart();
        assertEquals(
                "setIntervalPattern should not have side effects",
                expectedPattern,
                actualPattern);
    }
Example 2
static String value( Calendar calendar ) {
        return( calendar.get( Calendar.YEAR )  + "/" +
                calendar.get( Calendar.MONTH ) + "/" +
                calendar.get( Calendar.DATE ) ) ;
    }
Example 3
static public String ymdToString(Calendar cal) {
        double day = getJulianDay(cal);
        if (cal instanceof ChineseCalendar) {
            return "" + cal.get(Calendar.EXTENDED_YEAR) + "/" +
                (cal.get(Calendar.MONTH)+1) +
                (cal.get(Calendar.IS_LEAP_MONTH)==1?"(leap)":"") + "/" +
                cal.get(Calendar.DATE) + " (" + day + ", time=" + cal.getTimeInMillis() + ")";
        }
        return ymdToString(cal.get(Calendar.EXTENDED_YEAR),
                            cal.get(MONTH), cal.get(DATE)) +
                            " (" + day + ", time=" + cal.getTimeInMillis() + ")";
    }
Example 4
public void Test4125892() {
        GregorianCalendar cal = (GregorianCalendar) Calendar.getInstance();
        //DateFormat fmt = new SimpleDateFormat("MMMM d, yyyy G");
        //fmt = null;
        cal.clear();
        cal.set(Calendar.ERA, GregorianCalendar.BC);
        cal.set(Calendar.YEAR, 81); // 81 BC is a leap year (proleptically)
        cal.set(Calendar.MONTH, Calendar.FEBRUARY);
        cal.set(Calendar.DATE, 28);
        cal.add(Calendar.DATE, 1);
        if (cal.get(Calendar.DATE) != 29 ||
            !cal.isLeapYear(-80)) // -80 == 81 BC
            errln("Calendar not proleptic");
    }