List of usage examples for java.util Calendar JANUARY
int JANUARY
To view the source code for java.util Calendar JANUARY.
Click Source Link
From source file:org.techytax.util.DateHelper.java
public static boolean isBefore2015(Date date) { Calendar cal = new GregorianCalendar(); cal.set(Calendar.MONTH, Calendar.JANUARY); cal.set(Calendar.DAY_OF_MONTH, 1); cal.set(Calendar.YEAR, 2015); Date fromDate = cal.getTime(); return fromDate.after(date); }
From source file:org.jfree.data.time.junit.MillisecondTest.java
/** * Some checks for the getStart() method. *///from w ww . j a va2 s. c o m public void testGetStart() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55); cal.set(Calendar.MILLISECOND, 555); Millisecond m = new Millisecond(555, 55, 47, 3, 16, 1, 2006); assertEquals(cal.getTime(), m.getStart()); Locale.setDefault(saved); }
From source file:org.jfree.data.time.junit.HourTest.java
/** * Some checks for the getEnd() method.//from w w w.j av a 2s . com */ public void testGetEnd() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 8, 1, 59, 59); cal.set(Calendar.MILLISECOND, 999); Hour h = new Hour(1, 8, 1, 2006); assertEquals(cal.getTime(), h.getEnd()); Locale.setDefault(saved); }
From source file:cs.umass.edu.prepare.view.activities.CalendarActivity.java
/** * Changes the activity_calendar to display the next month. *//*from w w w. ja va 2s. c om*/ private void nextMonth() { int month = this.month.get(Calendar.MONTH); int year = this.month.get(Calendar.YEAR); if (month == Calendar.DECEMBER) { this.month.set(year + 1, Calendar.JANUARY, 1); } else { this.month.set(Calendar.MONTH, month + 1); } refreshCalendar(); }
From source file:gbc.jtimecalc.AbstractTimeDifferenceCalculatorTest.java
public void shouldReturn9Months0Days0Hours0Minutes0seconds() { Calendar end = prepareCalendar(1980, Calendar.JANUARY, 0, 0, 0, 0, 0); // 1.01.1980 00:00:00.0 setEndTime(end.getTimeInMillis());// www. j a va2 s. c o m Calendar start = (Calendar) end.clone(); start.add(Calendar.MONTH, -9); setStartTime(start.getTimeInMillis()); expectedValue = messages.get("9Months2Days"); }
From source file:com.gemstone.gemfire.rest.internal.web.controllers.RestAPIsAndInterOpsDUnitTest.java
public static void doPutsInClientCache() { ClientCache cache = GemFireCacheImpl.getInstance(); assertNotNull(cache);/*from www .j a va 2s. c o m*/ Region<String, Object> region = cache.getRegion(PEOPLE_REGION_NAME); //put person object final Person person1 = new Person(101L, "Mithali", "Dorai", "Raj", DateTimeUtils.createDate(1982, Calendar.DECEMBER, 4), Gender.FEMALE); final Person person2 = new Person(102L, "Sachin", "Ramesh", "Tendulkar", DateTimeUtils.createDate(1975, Calendar.DECEMBER, 14), Gender.MALE); final Person person3 = new Person(103L, "Saurabh", "Baburav", "Ganguly", DateTimeUtils.createDate(1972, Calendar.AUGUST, 29), Gender.MALE); final Person person4 = new Person(104L, "Rahul", "subrymanyam", "Dravid", DateTimeUtils.createDate(1979, Calendar.MARCH, 17), Gender.MALE); final Person person5 = new Person(105L, "Jhulan", "Chidambaram", "Goswami", DateTimeUtils.createDate(1983, Calendar.NOVEMBER, 25), Gender.FEMALE); region.put("1", person1); region.put("2", person2); region.put("3", person3); region.put("4", person4); region.put("5", person5); final Person person6 = new Person(101L, "Rahul", "Rajiv", "Gndhi", DateTimeUtils.createDate(1970, Calendar.MAY, 14), Gender.MALE); final Person person7 = new Person(102L, "Narendra", "Damodar", "Modi", DateTimeUtils.createDate(1945, Calendar.DECEMBER, 24), Gender.MALE); final Person person8 = new Person(103L, "Atal", "Bihari", "Vajpayee", DateTimeUtils.createDate(1920, Calendar.AUGUST, 9), Gender.MALE); final Person person9 = new Person(104L, "Soniya", "Rajiv", "Gandhi", DateTimeUtils.createDate(1929, Calendar.MARCH, 27), Gender.FEMALE); final Person person10 = new Person(104L, "Priyanka", "Robert", "Gandhi", DateTimeUtils.createDate(1973, Calendar.APRIL, 15), Gender.FEMALE); final Person person11 = new Person(104L, "Murali", "Manohar", "Joshi", DateTimeUtils.createDate(1923, Calendar.APRIL, 25), Gender.MALE); final Person person12 = new Person(104L, "Lalkrishna", "Parmhansh", "Advani", DateTimeUtils.createDate(1910, Calendar.JANUARY, 01), Gender.MALE); final Person person13 = new Person(104L, "Shushma", "kumari", "Swaraj", DateTimeUtils.createDate(1943, Calendar.AUGUST, 10), Gender.FEMALE); final Person person14 = new Person(104L, "Arun", "raman", "jetly", DateTimeUtils.createDate(1942, Calendar.OCTOBER, 27), Gender.MALE); final Person person15 = new Person(104L, "Amit", "kumar", "shah", DateTimeUtils.createDate(1958, Calendar.DECEMBER, 21), Gender.MALE); final Person person16 = new Person(104L, "Shila", "kumari", "Dixit", DateTimeUtils.createDate(1927, Calendar.FEBRUARY, 15), Gender.FEMALE); Map<String, Object> userMap = new HashMap<String, Object>(); userMap.put("6", person6); userMap.put("7", person7); userMap.put("8", person8); userMap.put("9", person9); userMap.put("10", person10); userMap.put("11", person11); userMap.put("12", person12); userMap.put("13", person13); userMap.put("14", person14); userMap.put("15", person15); userMap.put("16", person16); region.putAll(userMap); if (cache != null) cache.getLogger().info("Gemfire Cache Client: Puts successfully done"); }
From source file:org.jfree.data.time.junit.MillisecondTest.java
/** * Some checks for the getEnd() method./*ww w . j a v a 2 s . co m*/ */ public void testGetEnd() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55); cal.set(Calendar.MILLISECOND, 555); Millisecond m = new Millisecond(555, 55, 47, 3, 16, 1, 2006); assertEquals(cal.getTime(), m.getEnd()); Locale.setDefault(saved); }
From source file:cs.umass.edu.prepare.view.activities.CalendarActivity.java
/** * Changes the activity_calendar to show the previous month. */// w w w. j ava 2 s . co m private void previousMonth() { int month = this.month.get(Calendar.MONTH); int year = this.month.get(Calendar.YEAR); if (month == Calendar.JANUARY) { this.month.set(year - 1, Calendar.DECEMBER, 1); } else { this.month.set(Calendar.MONTH, month - 1); } refreshCalendar(); }
From source file:org.jfree.data.time.junit.DayTest.java
/** * Some checks for the getEnd() method.//from w w w . j a v a 2 s.c o m */ public void testGetEnd() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(1900, Calendar.JANUARY, 1, 23, 59, 59); cal.set(Calendar.MILLISECOND, 999); Day d = new Day(1, 1, 1900); assertEquals(cal.getTime(), d.getEnd()); Locale.setDefault(saved); }
From source file:com.sunchenbin.store.feilong.core.date.DateUtil.java
/** * <code>week</code>./*from w ww.j a v a 2 s . c o m*/ * * <pre> * 2015-7-29 14:08 * * DateUtil.getFirstWeekOfSpecifyDateYear(NOW, Calendar.FRIDAY) * return 2015-01-02 00:00:00.000 * * DateUtil.getFirstWeekOfSpecifyDateYear(NOW, Calendar.MONDAY) * return 2015-01-05 00:00:00.000 * </pre> * * @param date * * @param week * 1 ?2 3 4 5 6 7, ? {@link Calendar#SUNDAY}, {@link Calendar#MONDAY}, {@link Calendar#TUESDAY}, * {@link Calendar#WEDNESDAY}, {@link Calendar#THURSDAY}, {@link Calendar#FRIDAY}, {@link Calendar#SATURDAY} * @return the first week of specify date year * @see Calendar#SUNDAY * @see Calendar#MONDAY * @see Calendar#TUESDAY * @see Calendar#WEDNESDAY * @see Calendar#THURSDAY * @see Calendar#FRIDAY * @see Calendar#SATURDAY * @since 1.3.0 */ public static Date getFirstWeekOfSpecifyDateYear(Date date, int week) { Calendar calendar = toCalendar(date); calendar.clear(); calendar.set(Calendar.YEAR, getYear(date)); calendar.set(Calendar.MONTH, Calendar.JANUARY); calendar.set(Calendar.DAY_OF_WEEK_IN_MONTH, 1); calendar.set(Calendar.DAY_OF_WEEK, week); //DAY_OF_WEEK_IN_MONTH ? DAY_OF_WEEK ,??? // WEEK_OF_MONTH WEEK_OF_YEAR ??,? ? getFirstDayOfWeek() getMinimalDaysInFirstWeek() //DAY_OF_MONTH 1 7 DAY_OF_WEEK_IN_MONTH 1 //8 14 DAY_OF_WEEK_IN_MONTH 2,? //DAY_OF_WEEK_IN_MONTH 0 DAY_OF_WEEK_IN_MONTH 1 ? //?,,? DAY_OF_WEEK = SUNDAY, DAY_OF_WEEK_IN_MONTH = -1 //?,???? //, 31 , DAY_OF_WEEK_IN_MONTH -1 DAY_OF_WEEK_IN_MONTH 5 DAY_OF_WEEK_IN_MONTH 4 ?? return CalendarUtil.toDate(calendar); }