Search in sources :

Example 21 with TimeZone

use of java.util.TimeZone in project j2objc by google.

the class SimpleTimeZoneTest method testDstParis2014_30thMarch_26thOctober_UtcTime.

public void testDstParis2014_30thMarch_26thOctober_UtcTime() {
    TimeZone timeZone = new SimpleTimeZone(PARIS_RAW_OFFSET, "Europe/Paris", Calendar.MARCH, 30, 0, 3600000, SimpleTimeZone.UTC_TIME, Calendar.OCTOBER, 26, 0, 3600000, SimpleTimeZone.UTC_TIME, 3600000);
    checkDstParis2014(timeZone);
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Example 22 with TimeZone

use of java.util.TimeZone in project j2objc by google.

the class SimpleTimeZoneTest method testDstNewYork2014_2ndSundayMarch_1stSundayNovember_StandardTime.

public void testDstNewYork2014_2ndSundayMarch_1stSundayNovember_StandardTime() {
    TimeZone timeZone = new SimpleTimeZone(NEW_YORK_RAW_OFFSET, "EST", Calendar.MARCH, 2, Calendar.SUNDAY, 7200000, SimpleTimeZone.STANDARD_TIME, Calendar.NOVEMBER, 1, Calendar.SUNDAY, 3600000, SimpleTimeZone.STANDARD_TIME, 3600000);
    checkDstNewYork2014(timeZone);
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Example 23 with TimeZone

use of java.util.TimeZone in project j2objc by google.

the class TimeZoneTest method testOverflowing32BitUnixDates.

// http://b/18839557
public void testOverflowing32BitUnixDates() {
    final TimeZone tz = TimeZone.getTimeZone("America/New_York");
    // This timezone didn't have any daylight savings prior to 1917 and this
    // date is sometime in 1901.
    assertFalse(tz.inDaylightTime(new Date(-2206292400000L)));
    assertEquals(-18000000, tz.getOffset(-2206292400000L));
    // Nov 30th 2039, no daylight savings as per current rules.
    assertFalse(tz.inDaylightTime(new Date(2206292400000L)));
    assertEquals(-18000000, tz.getOffset(2206292400000L));
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone) Date(java.util.Date)

Example 24 with TimeZone

use of java.util.TimeZone in project j2objc by google.

the class TimeZoneTest method test_useDaylightTime_Taiwan.

// http://code.google.com/p/android/issues/detail?id=877
public void test_useDaylightTime_Taiwan() {
    TimeZone asiaTaipei = TimeZone.getTimeZone("Asia/Taipei");
    assertFalse("Taiwan doesn't use DST", asiaTaipei.useDaylightTime());
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Example 25 with TimeZone

use of java.util.TimeZone in project j2objc by google.

the class TimeZoneTest method testTimeZoneIDLocalization.

public void testTimeZoneIDLocalization() {
    Locale defaultLocale = Locale.getDefault();
    try {
        Locale.setDefault(new Locale("en"));
        TimeZone en_timezone = TimeZone.getTimeZone("GMT+09:00");
        Locale.setDefault(new Locale("ar"));
        TimeZone ar_timezone = TimeZone.getTimeZone("GMT+09:00");
        assertEquals(en_timezone.getID(), ar_timezone.getID());
    } finally {
        Locale.setDefault(defaultLocale);
    }
}
Also used : Locale(java.util.Locale) TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

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