use of java.util.GregorianCalendar in project j2objc by google.
the class SimpleDateFormatTest method test_parse_dayOfYearPatterns.
public void test_parse_dayOfYearPatterns() throws Exception {
GregorianCalendar cal = new GregorianCalendar(1970, Calendar.JANUARY, 1);
cal.setTimeZone(TimeZone.getTimeZone("GMT+0:1"));
cal.set(Calendar.DAY_OF_YEAR, 243);
assertParse("D z", "243 GMT+00:00", cal.getTime(), 0, 13);
}
use of java.util.GregorianCalendar in project j2objc by google.
the class SimpleDateFormatTest method test_timeZoneFormatting.
public void test_timeZoneFormatting() {
// tests specific to formatting of timezones
Date summerDate = new GregorianCalendar(1999, Calendar.JUNE, 2, 15, 3, 6).getTime();
Date winterDate = new GregorianCalendar(1999, Calendar.JANUARY, 12).getTime();
verifyFormatTimezone("America/Los_Angeles", "PDT, Pacific Daylight Time", "-0700, GMT-07:00", summerDate);
verifyFormatTimezone("America/Los_Angeles", "PST, Pacific Standard Time", "-0800, GMT-08:00", winterDate);
verifyFormatTimezone("GMT-7", "GMT-07:00, GMT-07:00", "-0700, GMT-07:00", summerDate);
verifyFormatTimezone("GMT-7", "GMT-07:00, GMT-07:00", "-0700, GMT-07:00", winterDate);
verifyFormatTimezone("GMT+14", "GMT+14, GMT+14:00", "+1400, GMT+14:00", summerDate);
verifyFormatTimezone("GMT+14", "GMT+14, GMT+14:00", "+1400, GMT+14:00", winterDate);
// this fails on the RI!
verifyFormatTimezone("America/Detroit", "EDT, Eastern Daylight Time", "-0400, GMT-04:00", summerDate);
verifyFormatTimezone("America/Detroit", "EST, Eastern Standard Time", "-0500, GMT-05:00", winterDate);
// Pacific/Kiritimati is one of the timezones supported only in mJava
verifyFormatTimezone("Pacific/Kiritimati", "GMT+14, Line Islands Time", "+1400, GMT+14:00", summerDate);
verifyFormatTimezone("Pacific/Kiritimati", "GMT+14, Line Islands Time", "+1400, GMT+14:00", winterDate);
verifyFormatTimezone("EST", "GMT-5, GMT-05:00", "-0500, GMT-05:00", summerDate);
verifyFormatTimezone("EST", "GMT-5, GMT-05:00", "-0500, GMT-05:00", winterDate);
verifyFormatTimezone("GMT+14", "GMT+14, GMT+14:00", "+1400, GMT+14:00", summerDate);
verifyFormatTimezone("GMT+14", "GMT+14, GMT+14:00", "+1400, GMT+14:00", winterDate);
}
use of java.util.GregorianCalendar in project j2objc by google.
the class SimpleDateFormatTest method testNonDstZoneWithDstTimestampForNonHourDstZone.
public void testNonDstZoneWithDstTimestampForNonHourDstZone() throws Exception {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm zzzz", Locale.US);
Calendar calendar = new GregorianCalendar(AUSTRALIA_LORD_HOWE);
//9:00 GMT+10:30
calendar.setTime(format.parse("2010-12-21T19:30 Lord Howe Standard Time"));
// 9:00 GMT+11:00
assertEquals(20, calendar.get(Calendar.HOUR_OF_DAY));
assertEquals(0, calendar.get(Calendar.MINUTE));
}
use of java.util.GregorianCalendar in project j2objc by google.
the class SimpleDateFormatTest method testDstZoneNameWithNonDstTimestamp.
public void testDstZoneNameWithNonDstTimestamp() throws Exception {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm zzzz", Locale.US);
Calendar calendar = new GregorianCalendar(AMERICA_LOS_ANGELES);
// 18:00 GMT-8
calendar.setTime(format.parse("2011-06-21T10:00 Pacific Standard Time"));
// 18:00 GMT-7
assertEquals(11, calendar.get(Calendar.HOUR_OF_DAY));
assertEquals(0, calendar.get(Calendar.MINUTE));
}
use of java.util.GregorianCalendar in project j2objc by google.
the class SimpleDateFormatTest method testDstZoneWithNonDstTimestampForNonHourDstZone.
// http://b/4723412
public void testDstZoneWithNonDstTimestampForNonHourDstZone() throws Exception {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm zzzz", Locale.US);
Calendar calendar = new GregorianCalendar(AUSTRALIA_LORD_HOWE);
// 9:00 GMT+11
calendar.setTime(format.parse("2011-06-21T20:00 Lord Howe Daylight Time"));
// 9:00 GMT+10:30
assertEquals(19, calendar.get(Calendar.HOUR_OF_DAY));
assertEquals(30, calendar.get(Calendar.MINUTE));
}
Aggregations