Java Code Examples for android.icu.util.Calendar#WEDNESDAY
The following examples show how to use
android.icu.util.Calendar#WEDNESDAY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CalendarRegressionTest.java From j2objc with Apache License 2.0 | 5 votes |
@Test public void TestT5555() throws Exception { Calendar cal = Calendar.getInstance(); // Set date to Wednesday, February 21, 2007 cal.set(2007, Calendar.FEBRUARY, 21); try { // Advance month by three years cal.add(Calendar.MONTH, 36); // Move to last Wednesday of month. cal.set(Calendar.DAY_OF_WEEK_IN_MONTH, -1); cal.getTime(); } catch (Exception e) { errln("Got an exception calling getTime()."); } int yy, mm, dd, ee; yy = cal.get(Calendar.YEAR); mm = cal.get(Calendar.MONTH); dd = cal.get(Calendar.DATE); ee = cal.get(Calendar.DAY_OF_WEEK_IN_MONTH); if (yy != 2010 || mm != Calendar.FEBRUARY || dd != 24 || ee != Calendar.WEDNESDAY) { errln("Got date " + yy + "/" + (mm + 1) + "/" + dd + ", expected 2010/2/24"); } }
Example 2
Source File: TimeZoneBoundaryTest.java From j2objc with Apache License 2.0 | 4 votes |
/** * Test new rule formats. */ @Test public void TestNewRules() { //logln(Locale.getDefault().getDisplayName()); //logln(TimeZone.getDefault().getID()); //logln(new Date(0)); if (true) { // Doesn't matter what the default TimeZone is here, since we // are creating our own TimeZone objects. SimpleTimeZone tz; java.util.Calendar tempcal = java.util.Calendar.getInstance(); tempcal.clear(); logln("-----------------------------------------------------------------"); logln("Aug 2ndTues .. Mar 15"); tz = new SimpleTimeZone(-8*ONE_HOUR, "Test_1", Calendar.AUGUST, 2, Calendar.TUESDAY, 2*ONE_HOUR, Calendar.MARCH, 15, 0, 2*ONE_HOUR); //logln(tz.toString()); logln("========================================"); tempcal.set(1997, 0, 1); _testUsingBinarySearch(tz, tempcal.getTime(), 858416400000L); logln("========================================"); tempcal.set(1997, 6, 1); _testUsingBinarySearch(tz, tempcal.getTime(), 871380000000L); logln("-----------------------------------------------------------------"); logln("Apr Wed>=14 .. Sep Sun<=20"); tz = new SimpleTimeZone(-8*ONE_HOUR, "Test_2", Calendar.APRIL, 14, -Calendar.WEDNESDAY, 2*ONE_HOUR, Calendar.SEPTEMBER, -20, -Calendar.SUNDAY, 2*ONE_HOUR); //logln(tz.toString()); logln("========================================"); tempcal.set(1997, 0, 1); _testUsingBinarySearch(tz, tempcal.getTime(), 861184800000L); logln("========================================"); tempcal.set(1997, 6, 1); _testUsingBinarySearch(tz, tempcal.getTime(), 874227600000L); } /* if (true) { logln("========================================"); logln("Stepping using millis"); _testUsingMillis(new Date(97,0,1), false); } if (true) { logln("========================================"); logln("Stepping using fields"); _testUsingFields(1997, false); } if (false) { cal.clear(); cal.set(1997, 3, 5, 10, 0); // cal.inDaylightTime(); logln("Date = " + cal.getTime()); logln("Millis = " + cal.getTime().getTime()/3600000); } */ }