Search in sources :

Example 81 with TimeZone

use of java.util.TimeZone in project robovm by robovm.

the class TimeZoneTest method testHasSameRules.

// http://code.google.com/p/android/issues/detail?id=11918
public void testHasSameRules() throws Exception {
    TimeZone denver = TimeZone.getTimeZone("America/Denver");
    TimeZone phoenix = TimeZone.getTimeZone("America/Phoenix");
    assertFalse(denver.hasSameRules(phoenix));
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Example 82 with TimeZone

use of java.util.TimeZone in project robovm by robovm.

the class TimeZoneTest method testCustomTimeZoneDisplayNames.

// http://b/3049014
public void testCustomTimeZoneDisplayNames() {
    TimeZone tz0001 = new SimpleTimeZone(60000, "ONE MINUTE");
    TimeZone tz0130 = new SimpleTimeZone(5400000, "ONE HOUR, THIRTY");
    TimeZone tzMinus0130 = new SimpleTimeZone(-5400000, "NEG ONE HOUR, THIRTY");
    assertEquals("GMT+00:01", tz0001.getDisplayName(false, TimeZone.SHORT, Locale.US));
    assertEquals("GMT+01:30", tz0130.getDisplayName(false, TimeZone.SHORT, Locale.US));
    assertEquals("GMT-01:30", tzMinus0130.getDisplayName(false, TimeZone.SHORT, Locale.US));
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Example 83 with TimeZone

use of java.util.TimeZone in project robovm by robovm.

the class TimeZoneTest method testAllDisplayNames.

public void testAllDisplayNames() throws Exception {
    for (Locale locale : Locale.getAvailableLocales()) {
        for (String id : TimeZone.getAvailableIDs()) {
            TimeZone tz = TimeZone.getTimeZone(id);
            assertNotNull(tz.getDisplayName(false, TimeZone.LONG, locale));
        }
    }
}
Also used : Locale(java.util.Locale) TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Example 84 with TimeZone

use of java.util.TimeZone in project robovm by robovm.

the class OldTimeZoneTest method test_getDisplayNameZI.

public void test_getDisplayNameZI() {
    Locale.setDefault(Locale.US);
    TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals("PST", tz.getDisplayName(false, 0));
    assertEquals("Pacific Daylight Time", tz.getDisplayName(true, 1));
    assertEquals("Pacific Standard Time", tz.getDisplayName(false, 1));
}
Also used : TimeZone(java.util.TimeZone)

Example 85 with TimeZone

use of java.util.TimeZone in project robovm by robovm.

the class OldTimeZoneTest method test_getDisplayNameLjava_util_Locale.

public void test_getDisplayNameLjava_util_Locale() {
    TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals("Pacific Standard Time", tz.getDisplayName(new Locale("US")));
    assertEquals("heure normale du Pacifique", tz.getDisplayName(Locale.FRANCE));
}
Also used : Locale(java.util.Locale) TimeZone(java.util.TimeZone)

Aggregations

TimeZone (java.util.TimeZone)577 Date (java.util.Date)140 Calendar (java.util.Calendar)137 SimpleTimeZone (java.util.SimpleTimeZone)89 Test (org.junit.Test)85 SimpleDateFormat (java.text.SimpleDateFormat)69 Locale (java.util.Locale)69 GregorianCalendar (java.util.GregorianCalendar)56 ArrayList (java.util.ArrayList)32 DateFormat (java.text.DateFormat)24 ParseException (java.text.ParseException)23 IOException (java.io.IOException)20 Map (java.util.Map)15 HashSet (java.util.HashSet)13 PreparedStatement (java.sql.PreparedStatement)11 HashMap (java.util.HashMap)11 DateTimeZone (org.joda.time.DateTimeZone)11 Support_TimeZone (tests.support.Support_TimeZone)10 Resources (android.content.res.Resources)9 SQLException (java.sql.SQLException)9