Package com.ibm.icu.util

Examples of com.ibm.icu.util.Calendar.clear()


        ((SimpleDateFormat)format).applyPattern("y.M.d")// Note: just 'y' doesn't work here.
        ParsePosition pos = new ParsePosition(0);
        Date aDate = format.parse("1.1.9", pos); // after the start of heisei accession.  Jan 1, 1H wouldn't work  because it is actually showa 64
        String inEn = enjformat.format(aDate);

        cal.clear();
        cal.setTime(aDate);
        int gotYear = cal.get(Calendar.YEAR);
        int gotEra = cal.get(Calendar.ERA);
       
        int expectYear = 1;
View Full Code Here


        // Test parse with incomplete information
        logln("Testing parse w/ just year...");
        Calendar cal2 = new JapaneseCalendar(loc);
        SimpleDateFormat fmt = new SimpleDateFormat("y", loc);
        SimpleDateFormat fmt2 = new SimpleDateFormat("HH:mm:ss.S MMMM d, yyyy G", new ULocale("en_US@calendar=gregorian"));
        cal2.clear();
        String samplestr = "1";
        logln("Test Year: " + samplestr);
        try {
            aDate = fmt.parse(samplestr);
        } catch (ParseException pe) {
View Full Code Here

            {1960, 1, 15},
            {1960, 6, 15},
        };

        Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
        cal.clear();

        // Set up rule equivalency test range
        long low, high;
        cal.set(1900, 0, 1);
        low = cal.getTimeInMillis();
View Full Code Here

        cal.set(2040, 0, 1);
        high = cal.getTimeInMillis();

        // Set up test dates
        Date[] DATES = new Date[testDateData.length];
        cal.clear();
        for (int i = 0; i < DATES.length; i++) {
            cal.set(testDateData[i][0], testDateData[i][1], testDateData[i][2]);
            DATES[i] = cal.getTime();
        }
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.text.SimpleDateFormat.parse(String, Calendar, ParsePosition)'
     */
    public void testParseStringCalendarParsePosition() {
        Calendar cal = Calendar.getInstance(tzp);
        cal.clear();
        ParsePosition pp = new ParsePosition(0);
        SimpleDateFormat sdf = new SimpleDateFormat(hmzmdy);
        sdf.parse(hmzmdyStr, cal, pp);
        assertEquals(date, cal.getTime());
        // note: java doesn't return the parsed time zone
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.util.Calendar.setTime(Date)'
     */
    public void testSetTime() {
        Calendar cal = Calendar.getInstance();
        cal.clear();
        cal.set(2006, 0, 20, 9, 30, 0);
        Date date = cal.getTime();
        cal = Calendar.getInstance();
        cal.setTime(date);
        assertEquals(date, cal.getTime());
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.util.Calendar.setTimeInMillis(long)'
     */
    public void testSetTimeInMillis() {
        Calendar cal = Calendar.getInstance();
        cal.clear();
        cal.set(2006, 0, 20, 9, 30, 0);
        long millis = cal.getTimeInMillis();
        Date date = cal.getTime();
       
        cal = Calendar.getInstance();
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.util.Calendar.get(int)'
     */
    public void testGet() {
        Calendar cal = Calendar.getInstance();
        cal.clear();
        cal.set(2006, 0, 20, 9, 30, 0);
        assertEquals(0, cal.get(Calendar.MONTH));
        assertEquals(20, cal.get(Calendar.DAY_OF_MONTH));
        assertEquals(30, cal.get(Calendar.MINUTE));
    }
View Full Code Here

     * Test method for 'com.ibm.icu.util.Calendar.clear()'
     */
    public void testClear() {
        Calendar cal = Calendar.getInstance();
        cal.set(1997, 9, 15, 14, 25, 51);
        cal.clear();
        assertEquals(0, cal.get(Calendar.MONTH));
    }

    /*
     * Test method for 'com.ibm.icu.util.Calendar.clear(int)'
View Full Code Here

     */
    public void testClearInt() {
        Calendar cal = Calendar.getInstance();
        cal.set(1997, 9, 15, 14, 25, 51);
        assertTrue(cal.isSet(Calendar.DAY_OF_MONTH));
        cal.clear(Calendar.DAY_OF_MONTH);
        assertFalse(cal.isSet(Calendar.DAY_OF_MONTH));
    }

    /*
     * Test method for 'com.ibm.icu.util.Calendar.isSet(int)'
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.