Code example for SimpleTimeZone

Methods: inDaylightTimesetEndRulesetStartRuleuseDaylightTime

	 * @tests java.util.SimpleTimeZone#setStartRule(int, int, int, int, boolean) 
	public void test_setStartRuleIIIIZ() { 
		// Test for method void java.util.SimpleTimeZone.setStartRule(int, int, 
		// int, int, boolean) 
        SimpleTimeZone st = new SimpleTimeZone(0, "Test");
		// Spec indicates that both end and start must be set or result is 
		// undefined 
		st.setStartRule(Calendar.NOVEMBER, 1, Calendar.SUNDAY, 1, true);
		st.setEndRule(Calendar.NOVEMBER, 15, Calendar.SUNDAY, 1, false);
		assertTrue("StartRule improperly set1", st.useDaylightTime());
		assertTrue("StartRule improperly set2", st
				.inDaylightTime((new GregorianCalendar(1999, Calendar.NOVEMBER,
						7, 12, 0).getTime())));
		assertTrue("StartRule improperly set3", st
				.inDaylightTime((new GregorianCalendar(1999, Calendar.NOVEMBER,
						13, 12, 0).getTime())));
		assertTrue("StartRule improperly set4", !(st
				.inDaylightTime(new GregorianCalendar(1999, Calendar.NOVEMBER,
						6, 12, 0).getTime())));
		assertTrue("StartRule improperly set5", !(st
				.inDaylightTime(new GregorianCalendar(1999, Calendar.NOVEMBER,
						14, 12, 0).getTime())));
	 * @tests java.util.SimpleTimeZone#setStartYear(int) 
Stop searching for code, let great code find you!  Add Codota to your java IDE