Package com.ibm.icu.util

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


                //logln();
               
                // Now compute the time from the fields, and make sure we
                // get the same answer back. This is a round-trip test.
                Date save = testCal.getTime();
                testCal.clear();
                testCal.set(Calendar.YEAR, DATA[j+1+i] < 25 ? 1998 : 1997);
                testCal.set(Calendar.WEEK_OF_YEAR, DATA[j+1+i]);
                testCal.set(Calendar.DAY_OF_WEEK, (i%7) + Calendar.SUNDAY);
                if (!testCal.getTime().equals(save)) {
                    logln("  Parse failed: " + testCal.getTime());
View Full Code Here


        cal = new GregorianCalendar(utc, Locale.ENGLISH);
        cal.setGregorianChange(new Date(before0001AD));
        for(i = 0; i < dotNetDateTimeTicks.length; i += kIncrement) {
            /* Test conversion from .Net/Universal time to ICU time. */
            millis = UniversalTimeScale.toLong(dotNetDateTimeTicks[i + kTicks], UniversalTimeScale.ICU4C_TIME);
            cal.clear();
            cal.set((int)dotNetDateTimeTicks[i + kYear],
                    (int)dotNetDateTimeTicks[i + kMonth] - 1, /* Java & ICU use January = month 0. */
                    (int)dotNetDateTimeTicks[i + kDay]);
            icuDate = cal.getTimeInMillis();
            if(millis != icuDate) {
View Full Code Here

        public long getTime(int year, int month, int dayOfMonth, int hour, int minute, int second) {
            long time;
            if (tzobj instanceof com.ibm.icu.util.TimeZone) {
                GregorianCalendar cal = new GregorianCalendar();
                cal.setTimeZone((com.ibm.icu.util.TimeZone)tzobj);
                cal.clear();
                cal.set(year, month, dayOfMonth, hour, minute, second);
                time = cal.getTimeInMillis();
            } else if (tzobj instanceof java.util.TimeZone) {
                java.util.GregorianCalendar cal = new java.util.GregorianCalendar();
                cal.setTimeZone((java.util.TimeZone)tzobj);
View Full Code Here

                cal.set(year, month, dayOfMonth, hour, minute, second);
                time = cal.getTimeInMillis();
            } else if (tzobj instanceof java.util.TimeZone) {
                java.util.GregorianCalendar cal = new java.util.GregorianCalendar();
                cal.setTimeZone((java.util.TimeZone)tzobj);
                cal.clear();
                cal.set(year, month, dayOfMonth, hour, minute, second);
                time = cal.getTimeInMillis();
            } else {
                throw new IllegalStateException("Unsupported TimeZone implementation");
            }
View Full Code Here

        for (int i=0; i<DISAM.length; i+=4) {
            int y = ((Integer)DISAM[i]).intValue();
            int woy = ((Integer)DISAM[i+1]).intValue();
            int dow = ((Integer)DISAM[i+2]).intValue();
            Date exp = (Date)DISAM[i+3];
            testCal.clear();
            testCal.set(Calendar.YEAR, y);
            testCal.set(Calendar.WEEK_OF_YEAR, woy);
            testCal.set(Calendar.DAY_OF_WEEK, dow);
            log(y + "-W" + woy +
                             "-DOW" + dow + " expect:" + exp +
View Full Code Here

     * Check isLeapYear for BC years.
     */
    public void Test4125881() {
        GregorianCalendar cal = (GregorianCalendar) Calendar.getInstance();
        DateFormat fmt = new SimpleDateFormat("MMMM d, yyyy G");
        cal.clear();
        for (int y=-20; y<=10; ++y) {
            cal.set(Calendar.ERA, y < 1 ? GregorianCalendar.BC : GregorianCalendar.AD);
            cal.set(Calendar.YEAR, y < 1 ? 1 - y : y);
            logln(y + " = " + fmt.format(cal.getTime()) + " " +
                               cal.isLeapYear(y));
View Full Code Here

     */
    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);
View Full Code Here

        Date d;
       
        for (int i=0; i<5; ++i) {
            if (i>0) logln("---");

            cal.clear();
            cal.set(1998, Calendar.APRIL, 5, i, 0);
            d = cal.getTime();
            String s0 = d.toString();
            logln("0 " + i + ": " + s0);
View Full Code Here

            cal.set(1998, Calendar.APRIL, 5, i, 0);
            d = cal.getTime();
            String s0 = d.toString();
            logln("0 " + i + ": " + s0);

            cal.clear();
            cal.set(1998, Calendar.APRIL, 4, i+24, 0);
            d = cal.getTime();
            String sPlus = d.toString();
            logln("+ " + i + ": " + sPlus);
View Full Code Here

            cal.set(1998, Calendar.APRIL, 4, i+24, 0);
            d = cal.getTime();
            String sPlus = d.toString();
            logln("+ " + i + ": " + sPlus);

            cal.clear();
            cal.set(1998, Calendar.APRIL, 6, i-24, 0);
            d = cal.getTime();
            String sMinus = d.toString();
            logln("- " + i + ": " + sMinus);
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.