Package com.ibm.icu.text

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


       
        GregorianCalendar gc = new GregorianCalendar();
        gc.setGregorianChange(new Date(Long.MIN_VALUE)); // act like proleptic Gregorian
        gc.setTime(cal.getTime());
        fmt.setCalendar(new GregorianCalendar());
        assertEquals("Gregorian Date", "Tue Aug 28, 0007 AD", fmt.format(gc));
    }

    public void TestBasic() {
        EthiopicCalendar cal = new EthiopicCalendar();
        cal.clear();
View Full Code Here


     */
    public void testFormatCalendarStringBufferFieldPosition() {
        StringBuffer buf = new StringBuffer();
        FieldPosition fp = new FieldPosition(0);
        SimpleDateFormat sdf = new SimpleDateFormat(hmzmdy);
        sdf.format(cal, buf, fp);
        assertEquals(hmzmdyStr, buf.toString());
    }

    /*
     * Test method for 'com.ibm.icu.text.SimpleDateFormat.parse(String, Calendar, ParsePosition)'
View Full Code Here

     * Test method for 'com.ibm.icu.text.SimpleDateFormat.SimpleDateFormat()'
     */
    public void testSimpleDateFormat() {
        SimpleDateFormat sdf = new SimpleDateFormat();
        java.text.SimpleDateFormat jsdf = new java.text.SimpleDateFormat();
        assertEquals(jsdf.format(date), sdf.format(date));
    }

    /*
     * Test method for 'com.ibm.icu.text.SimpleDateFormat.SimpleDateFormat(String)'
     */
 
View Full Code Here

     * Test method for 'com.ibm.icu.text.SimpleDateFormat.SimpleDateFormat(String)'
     */
    public void testSimpleDateFormatString() {
        SimpleDateFormat sdf = new SimpleDateFormat(mdy);
        java.text.SimpleDateFormat jsdf = new java.text.SimpleDateFormat(mdy);
        assertEquals(jsdf.format(date), sdf.format(date));
    }

    /*
     * Test method for 'com.ibm.icu.text.SimpleDateFormat.SimpleDateFormat(String, Locale)'
     */
 
View Full Code Here

     */
    public void testSimpleDateFormatStringLocale() {
        Locale l = Locale.JAPAN;
        SimpleDateFormat sdf = new SimpleDateFormat(mdy, l);
        java.text.SimpleDateFormat jsdf = new java.text.SimpleDateFormat(mdy, l);
        assertEquals(jsdf.format(date), sdf.format(date));
    }

    /*
     * Test method for 'com.ibm.icu.text.SimpleDateFormat.SimpleDateFormat(String, ULocale)'
     */
 
View Full Code Here

     */
    public void testSimpleDateFormatStringULocale() {
        ULocale l = ULocale.JAPAN;
        SimpleDateFormat sdf = new SimpleDateFormat(mdy, l);
        java.text.SimpleDateFormat jsdf = new java.text.SimpleDateFormat(mdy, l.toLocale());
        assertEquals(jsdf.format(date), sdf.format(date));
    }

    /*
     * Test method for 'com.ibm.icu.text.SimpleDateFormat.SimpleDateFormat(String, DateFormatSymbols)'
     */
 
View Full Code Here

        Locale l = Locale.US;
        DateFormatSymbols dfs = new DateFormatSymbols(l);
        java.text.DateFormatSymbols jdfs = new java.text.DateFormatSymbols(l);
        SimpleDateFormat sdf = new SimpleDateFormat(mdy, dfs);
        java.text.SimpleDateFormat jsdf = new java.text.SimpleDateFormat(mdy, jdfs);
        assertEquals(jsdf.format(date), sdf.format(date));
    }

    /*
     * Test method for 'com.ibm.icu.text.SimpleDateFormat.set2DigitYearStart(Date)'
     */
 
View Full Code Here

     */
    public void testApplyPattern() {
        SimpleDateFormat sdf = new SimpleDateFormat();
        sdf.setTimeZone(tzc);
        sdf.applyPattern(hmzmdy);
        assertEquals(hmzmdyStr, sdf.format(date));
    }

    /*
     * Test method for 'com.ibm.icu.text.SimpleDateFormat.applyLocalizedPattern(String)'
     */
 
View Full Code Here

     */
    public void testApplyLocalizedPattern() {
        SimpleDateFormat sdf = new SimpleDateFormat();
        sdf.setTimeZone(tzc);
        sdf.applyLocalizedPattern(hmzmdy);
        assertEquals(hmzmdyStr, sdf.format(date));
    }

    /*
     * Test method for 'com.ibm.icu.text.SimpleDateFormat.getDateFormatSymbols()'
     */
 
View Full Code Here

    public void testSetDateFormatSymbols() {
        DateFormatSymbols dfs = new DateFormatSymbols(Locale.JAPAN);
        SimpleDateFormat sdf = new SimpleDateFormat(hmzmdy);
        sdf.setDateFormatSymbols(dfs);
        // assumes Japanese symbols do not have gregorian month names
        assertEquals(-1, sdf.format(date).indexOf("Jan"));
    }
}
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.