Package com.ibm.icu.text

Examples of com.ibm.icu.text.SimpleDateFormat.format()


        format.setTimeZone(this);
        Date d = new Date();
        if (style >= 2) {
            // Generic names may change time to time even for a single time zone.
            // This method returns the one used for the zone now.
            return format.format(d);
        } else {
            int[] offsets = new int[2];
            getOffset(d.getTime(), false, offsets);
            if ((daylight && offsets[1] != 0) || (!daylight && offsets[1] == 0)) {
                return format.format(d);
View Full Code Here


            return format.format(d);
        } else {
            int[] offsets = new int[2];
            getOffset(d.getTime(), false, offsets);
            if ((daylight && offsets[1] != 0) || (!daylight && offsets[1] == 0)) {
                return format.format(d);
            }

            // Create a new SimpleTimeZone as a stand-in for this zone; the stand-in
            // will have no DST, or DST during July, but the same ID and offset,
            // and hence the same display name.  We don't cache these because
View Full Code Here

                // or display name for daylight saving time was requested, but this zone no longer
                // observes DST.
                tz = new SimpleTimeZone(offsets[0], getID());
                format.setTimeZone(tz);
            }
            return format.format(d);
        }
    }

    /**
     * Returns the amount of time to be added to local standard time
View Full Code Here

            TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
            date=new SimpleDateFormat("dd MMM yyy (zzzz) 'is in week' ww");
            Calendar cal=Calendar.getInstance();
            cal.set(1997,Calendar.SEPTEMBER,30);
            Date now=cal.getTime();
            logln(date.format(now));
            cal.set(1997,Calendar.JANUARY,1);
            now=cal.getTime();
            logln(date.format(now));
            cal.set(1997,Calendar.JANUARY,8);
            now=cal.getTime();
View Full Code Here

            cal.set(1997,Calendar.SEPTEMBER,30);
            Date now=cal.getTime();
            logln(date.format(now));
            cal.set(1997,Calendar.JANUARY,1);
            now=cal.getTime();
            logln(date.format(now));
            cal.set(1997,Calendar.JANUARY,8);
            now=cal.getTime();
            logln(date.format(now));
            cal.set(1996,Calendar.DECEMBER,31);
            now=cal.getTime();
View Full Code Here

            cal.set(1997,Calendar.JANUARY,1);
            now=cal.getTime();
            logln(date.format(now));
            cal.set(1997,Calendar.JANUARY,8);
            now=cal.getTime();
            logln(date.format(now));
            cal.set(1996,Calendar.DECEMBER,31);
            now=cal.getTime();
            logln(date.format(now));
        }
        finally {
View Full Code Here

            cal.set(1997,Calendar.JANUARY,8);
            now=cal.getTime();
            logln(date.format(now));
            cal.set(1996,Calendar.DECEMBER,31);
            now=cal.getTime();
            logln(date.format(now));
        }
        finally {
            Locale.setDefault(saveLocale);
            TimeZone.setDefault(saveZone);
        }
View Full Code Here

                        String calWOY;
                        int actWOY = testCal.get(Calendar.WEEK_OF_YEAR);
                        if (actWOY < 1 || actWOY > 53) {
                            Date d = testCal.getTime();
                            calWOY = String.valueOf(actWOY);
                            output = testDesc + " - " + sdf.format(d) + "\t";
                            output = output + "\t" + calWOY;
                            logln(output);
                            fail = true;
                        }
                    }
View Full Code Here

        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));
            if (cal.isLeapYear(y) != ((y+40)%4 == 0))
                errln("Leap years broken");
        }
    }
View Full Code Here

                format.setCalendar((Calendar)calendar.clone());

                Date dateBefore = calendar.getTime();

                int maxYear = calendar.getActualMaximum(field);
                logln("maxYear: " + maxYear + " for " + format.format(calendar.getTime()));
                logln("date before: " + format.format(dateBefore));

                int years[] = {2000, maxYear-1, maxYear, maxYear+1};

                for (int i = 0; i < years.length; i++) {
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.