List of usage examples for java.util Calendar DECEMBER
int DECEMBER
To view the source code for java.util Calendar DECEMBER.
Click Source Link
From source file:org.jumpmind.symmetric.io.data.transform.ClarionDateTimeColumnTransform.java
public String convertClarionDate(String clarionDate, String clarionTime) { if (clarionDate != null && !StringUtils.isEmpty(clarionDate)) { Integer date = Integer.parseInt(clarionDate); Calendar cal = Calendar.getInstance(); cal.set(1800, Calendar.DECEMBER, 28, 0, 0, 0); cal.add(Calendar.DATE, date); cal.set(Calendar.MILLISECOND, 0); if (clarionTime != null && !StringUtils.isEmpty(clarionTime)) { Integer time = Integer.parseInt(clarionTime); if (time > 0) { cal.add(Calendar.MILLISECOND, (time - 1) * 10); }/* ww w . ja v a 2 s. c om*/ } return new SimpleDateFormat(DATE_FORMAT).format(cal.getTime()); } return null; }
From source file:net.audumla.astronomy.SeasonalEvent.java
protected static double summerStart(int year, double latitude) { Date t = Time.getZeroDate(); t = DateUtils.setYears(t, year);//from w w w . j a v a2 s . co m if (latitude >= 0) { t = DateUtils.setMonths(t, Calendar.JUNE); } else { t = DateUtils.setMonths(t, Calendar.DECEMBER); } return new JulianDate(t).julian(); }
From source file:org.sipfoundry.sipxconfig.dialplan.DialPlanContextTestIntegration.java
public void testAddDeleteRule() { m_dialPlanSetup.setupDefaultRegion(); // TODO - replace with IDialingRule mocks DialingRule r1 = new CustomDialingRule(); r1.setName("a1"); Schedule schedule = new GeneralSchedule(); schedule.setName("R1 Schedule"); WorkingHours[] hours = new WorkingHours[1]; WorkingTime wt = new WorkingTime(); hours[0] = new WorkingHours(); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal.set(2006, Calendar.DECEMBER, 31, 10, 00); hours[0].setStart(cal.getTime());/*from w ww . j ava2 s . c o m*/ cal.set(2006, Calendar.DECEMBER, 31, 11, 00); hours[0].setStop(cal.getTime()); hours[0].setEnabled(true); hours[0].setDay(ScheduledDay.WEDNESDAY); wt.setWorkingHours(hours); wt.setEnabled(true); schedule.setWorkingTime(wt); m_forwardingContext.saveSchedule(schedule); r1.setSchedule(schedule); CustomDialingRule r2 = new CustomDialingRule(); r2.setName("a2"); r2.setPermissionNames(Collections.singletonList(PermissionName.VOICEMAIL.getName())); m_dialPlanContext.storeRule(r1); assertEquals(1 + DEFAULT_DIAL_PLAN_SIZE, m_dialPlanContext.getRules().size()); assertEquals("R1 Schedule", ((CustomDialingRule) m_dialPlanContext.load(DialingRule.class, r1.getId())) .getSchedule().getName()); m_dialPlanContext.storeRule(r2); assertEquals(2 + DEFAULT_DIAL_PLAN_SIZE, m_dialPlanContext.getRules().size()); CustomDialingRule r = (CustomDialingRule) m_dialPlanContext.load(DialingRule.class, r2.getId()); assertEquals(r2.getPermissionNames().get(0), r.getPermissionNames().get(0)); Integer id1 = r1.getId(); m_dialPlanContext.deleteRules(Collections.singletonList(id1)); Collection rules = m_dialPlanContext.getRules(); assertTrue(rules.contains(r2)); assertFalse(rules.contains(r1)); assertEquals(1 + DEFAULT_DIAL_PLAN_SIZE, rules.size()); }
From source file:org.lieuofs.commune.biz.GestionMutationCommuneTest.java
@Test public void testRechercherMutationBernoise() { // Recherche des mutations sur le canton de Berne MutationCommuneCritere critere = new MutationCommuneCritere(); critere.setCodeCanton("BE"); Calendar cal = Calendar.getInstance(); cal.set(1979, Calendar.DECEMBER, 1); critere.setDateDebut(cal.getTime()); cal.add(Calendar.YEAR, 2);//from ww w . j a v a 2s. c om critere.setDateFin(cal.getTime()); List<IMutationCommune> mutations = gestionnaire.rechercherMutation(critere); List<String> descriptions = new ArrayList<String>(); for (IMutationCommune mut : mutations) { descriptions.add(mut.getDescription()); } assertThat(mutations).hasSize(1); }
From source file:util.MyUtils.java
public static String getMonthString(int month) { switch (month - 1) { case Calendar.JANUARY: return "Jan"; case Calendar.FEBRUARY: return "Feb"; case Calendar.MARCH: return "Mar"; case Calendar.APRIL: return "Apr"; case Calendar.MAY: return "May"; case Calendar.JUNE: return "Jun"; case Calendar.JULY: return "Jul"; case Calendar.AUGUST: return "Aug"; case Calendar.SEPTEMBER: return "Sep"; case Calendar.OCTOBER: return "Oct"; case Calendar.NOVEMBER: return "Nov"; case Calendar.DECEMBER: return "Dec"; }/* w ww .ja v a 2s . c o m*/ return ""; }
From source file:net.audumla.astronomy.SeasonalEvent.java
protected static double winterStart(int year, double latitude) { Date t = Time.getZeroDate(); t = DateUtils.setYears(t, year);//w w w . j a v a 2s . c o m if (latitude >= 0) { t = DateUtils.setMonths(t, Calendar.DECEMBER); } else { t = DateUtils.setMonths(t, Calendar.JUNE); } return new JulianDate(t).julian(); }
From source file:stepReport.model.PeriodoModel.java
/** * Retorna a data da semana no periodo de 1 ano * @param Ano// w w w .j a v a2 s . co m * @return */ public String[] calcPeriodoAno(String Ano) { Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, Integer.parseInt(Ano)); c.set(Calendar.DAY_OF_YEAR, 1); int day = c.get(Calendar.DAY_OF_WEEK); while (day != Calendar.SUNDAY) { c.add(Calendar.DAY_OF_WEEK, 1); day = c.get(Calendar.DAY_OF_WEEK); } SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd"); String dataIni = fmt.format(c.getTime()); c.set(Calendar.YEAR, Integer.parseInt(Ano)); c.set(Integer.parseInt(Ano), Calendar.DECEMBER, 31); day = c.get(Calendar.DAY_OF_WEEK); while (day != Calendar.SUNDAY) { c.add(Calendar.DAY_OF_WEEK, 1); day = c.get(Calendar.DAY_OF_WEEK); } String dataFim = fmt.format(c.getTime()); String v[] = { dataIni, dataFim }; return v; }
From source file:de.forsthaus.backend.dao.impl.ChartDataDAOImpl.java
@Override public List<ChartData> getChartDataForCustomer(long kunId) { List<ChartData> result = new ArrayList<ChartData>(); if (kunId == 20) { Calendar calendar = new GregorianCalendar(); calendar.set(2009, Calendar.JANUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30))); calendar.set(2009, Calendar.FEBRUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(450.30))); calendar.set(2009, Calendar.MARCH, 15, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(820.10))); calendar.set(2009, Calendar.APRIL, 20, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(654.00))); calendar.set(2009, Calendar.MAY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30))); calendar.set(2009, Calendar.JUNE, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(520.30))); calendar.set(2009, Calendar.JULY, 22, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30))); calendar.set(2009, Calendar.AUGUST, 13, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(20.30))); calendar.set(2009, Calendar.SEPTEMBER, 6, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(480.30))); calendar.set(2009, Calendar.OCTOBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(520.30))); calendar.set(2009, Calendar.NOVEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.70))); calendar.set(2009, Calendar.DECEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(1220.90))); } else if (kunId == 21) { Calendar calendar = new GregorianCalendar(); calendar.set(2009, Calendar.JANUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30))); calendar.set(2009, Calendar.FEBRUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(450.30))); calendar.set(2009, Calendar.MARCH, 15, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.10))); calendar.set(2009, Calendar.APRIL, 20, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(154.00))); calendar.set(2009, Calendar.MAY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30))); calendar.set(2009, Calendar.JUNE, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.30))); calendar.set(2009, Calendar.JULY, 22, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(920.30))); calendar.set(2009, Calendar.AUGUST, 13, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30))); calendar.set(2009, Calendar.SEPTEMBER, 6, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(680.30))); calendar.set(2009, Calendar.OCTOBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(580.30))); calendar.set(2009, Calendar.NOVEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(820.70))); calendar.set(2009, Calendar.DECEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(220.90))); }/*ww w . j ava 2 s . c o m*/ return result; }
From source file:com.feilong.core.date.DateUtilTest.java
/** * TestDateUtilTest.// w ww. jav a 2 s . co m */ @Test public void testDateUtil() { Calendar calendar = Calendar.getInstance(); calendar.set(2014, Calendar.DECEMBER, 29); Date time = calendar.getTime(); assertEquals("2014-12-29", DateUtil.toString(time, "yyyy-MM-dd")); }
From source file:org.sipfoundry.sipxconfig.admin.dialplan.DialPlanContextTestDb.java
public void testAddDeleteRule() { m_resetDialPlanTask.reset(true);/*from ww w . j a v a 2 s . c o m*/ // TODO - replace with IDialingRule mocks DialingRule r1 = new CustomDialingRule(); r1.setName("a1"); Schedule schedule = new GeneralSchedule(); schedule.setName("R1 Schedule"); WorkingHours[] hours = new WorkingHours[1]; WorkingTime wt = new WorkingTime(); hours[0] = new WorkingHours(); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal.set(2006, Calendar.DECEMBER, 31, 10, 00); hours[0].setStart(cal.getTime()); cal.set(2006, Calendar.DECEMBER, 31, 11, 00); hours[0].setStop(cal.getTime()); hours[0].setEnabled(true); hours[0].setDay(ScheduledDay.WEDNESDAY); wt.setWorkingHours(hours); wt.setEnabled(true); schedule.setWorkingTime(wt); m_fwdContext.saveSchedule(schedule); m_fwdContext.flush(); r1.setSchedule(schedule); CustomDialingRule r2 = new CustomDialingRule(); r2.setName("a2"); r2.setPermissionNames(Collections.singletonList(PermissionName.VOICEMAIL.getName())); m_context.storeRule(r1); assertEquals(1 + DEFAULT_DIAL_PLAN_SIZE, m_context.getRules().size()); assertEquals("R1 Schedule", ((CustomDialingRule) m_context.load(DialingRule.class, r1.getId())).getSchedule().getName()); m_context.storeRule(r2); assertEquals(2 + DEFAULT_DIAL_PLAN_SIZE, m_context.getRules().size()); CustomDialingRule r = (CustomDialingRule) m_context.load(DialingRule.class, r2.getId()); assertEquals(r2.getPermissionNames().get(0), r.getPermissionNames().get(0)); Integer id1 = r1.getId(); m_context.deleteRules(Collections.singletonList(id1)); Collection rules = m_context.getRules(); assertTrue(rules.contains(r2)); assertFalse(rules.contains(r1)); assertEquals(1 + DEFAULT_DIAL_PLAN_SIZE, rules.size()); }