List of usage examples for org.joda.time DateTime getMonthOfYear
public int getMonthOfYear()
From source file:com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.DateMonthCalculator.java
License:Apache License
@Override public int intValueOf(Object o) { Date date = this.attribute.valueOf(o); DateTime time = new DateTime(date); return time.getMonthOfYear(); }
From source file:com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.TimestampMonthCalculator.java
License:Apache License
@Override public int intValueOf(Object o) { Timestamp timestamp = this.attribute.valueOf(o); DateTime time = new DateTime(timestamp.getTime()); return time.getMonthOfYear(); }
From source file:com.gu.openplatform.contentapi.ApiUrlFactory.java
License:Apache License
private String generateUrlRepresentation(DateTime date) { StringBuilder dateBuilder = new StringBuilder(); dateBuilder.append(date.getYear());//from www . ja va 2 s . c o m dateBuilder.append("-"); dateBuilder.append(date.getMonthOfYear()); dateBuilder.append("-"); dateBuilder.append(date.getDayOfMonth()); return dateBuilder.toString(); }
From source file:com.hm.cal.date.GregorianCalendar.java
License:Apache License
/** * Constructs a Gregorian Calendar given a Joda DateTime. * * @param dt a Joda DateTime./*w w w . ja va2 s . c o m*/ */ public GregorianCalendar(DateTime dt) { this(dt.getYear(), dt.getMonthOfYear(), dt.getDayOfMonth()); }
From source file:com.hmsinc.epicenter.util.DateTimeUtils.java
License:Open Source License
public static DateTime toStartOfDay(final DateTime date) { return new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), 0, 0, 0, 0, date.getZone());/*from w w w . j a v a2 s .c o m*/ }
From source file:com.hmsinc.epicenter.util.DateTimeUtils.java
License:Open Source License
public static DateTime toEndOfDay(final DateTime date) { return new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), 23, 59, 59, 999, date.getZone());/*from ww w . j a v a2s . com*/ }
From source file:com.hmsinc.epicenter.webapp.chart.TimeSeriesChart.java
License:Open Source License
/** * @param period// w w w . jav a2 s . c o m * @param date * @return */ private static org.jfree.data.time.RegularTimePeriod getEntryPeriod(final TimeSeriesPeriod period, final DateTime date) { final org.jfree.data.time.RegularTimePeriod ret; switch (period) { case DAY: ret = new Day(date.getDayOfMonth(), date.getMonthOfYear(), date.getYear()); break; case HOUR: ret = new Hour(date.getHourOfDay(), date.getDayOfYear(), date.getMonthOfYear(), date.getYear()); break; case MONTH: ret = new Month(date.getMonthOfYear(), date.getYear()); break; case YEAR: ret = new Year(date.getYear()); break; default: throw new UnsupportedOperationException("Unsupported period: " + period); } return ret; }
From source file:com.hmsinc.epicenter.webapp.remoting.ForecastingService.java
License:Open Source License
@Secured("ROLE_USER") @Transactional(readOnly = true)// w w w .jav a 2s .c o m @RemoteMethod public String getSeasonalTrendChart(final AnalysisParametersDTO paramsDTO) { final AnalysisParameters params = convertParameters(paramsDTO); // 60 day window final DateTime windowStart = params.getEndDate().minusDays(59); // Set the start date back 1 year + 60 days params.setStartDate(windowStart.minusYears(1).minusDays(59)); final TimeSeriesChart chart = new TimeSeriesChart(); final TimeSeries ts = queryService.queryForTimeSeries(params, paramsDTO.getAlgorithmName(), null); if (ts != null) { final TimeSeries forecast = waveletSeasonalTrendForecaster.process(ts.after(windowStart), ts.before(windowStart.minusDays(1)), null); final TimeSeries known = forecast.before(params.getEndDate()); final TimeSeries predicted = forecast.after(params.getEndDate().plusDays(1)); chart.addBand("70% Confidence Prediction", predicted, ResultType.LOWER_BOUND_70, ResultType.UPPER_BOUND_70, new Color(0x0072bf), new Color(0x0072bf)); chart.addBand("80% Confidence Prediction", predicted, ResultType.LOWER_BOUND_80, ResultType.UPPER_BOUND_80, new Color(0x0099ff), new Color(0x0099ff)); chart.addBand("90% Confidence Prediction", predicted, ResultType.LOWER_BOUND_90, ResultType.UPPER_BOUND_90, new Color(0x3fb2ff), new Color(0x3fb2ff)); chart.addBand("95% Confidence Prediction", predicted, ResultType.LOWER_BOUND_95, ResultType.UPPER_BOUND_95, new Color(0xbfe5ff), new Color(0xbfe5ff)); chart.add("Actual Value", known, ChartColor.VALUE.getColor(), LineStyle.DOTTED); chart.add("Actual Trend", known, ResultType.TREND, ChartColor.VALUE.getColor(), LineStyle.THICK); final DateTime knownFirst = known.first().getTime(); final DateTime predictedFirst = predicted.first().getTime(); final Marker marker = new IntervalMarker( new Day(knownFirst.getDayOfMonth(), knownFirst.getMonthOfYear(), knownFirst.getYear()) .getFirstMillisecond(), new Day(predictedFirst.getDayOfMonth(), predictedFirst.getMonthOfYear(), predictedFirst.getYear()).getFirstMillisecond(), Color.LIGHT_GRAY, new BasicStroke(2.0f), null, null, 1.0f); marker.setAlpha(0.3f); chart.getMarkers().add(marker); chart.setYLabel(params.getDataRepresentation().getDisplayName()); chart.setAlwaysScaleFromZero(false); } return chartService.getChartURL(chart); }
From source file:com.huang.rp.common.utils.TimeUtils.java
License:Apache License
/** * ?/*from www.j a v a 2 s .c om*/ * @return */ public static String getYYMMDDStr() { DateTime dt = new DateTime(); StringBuilder sb = new StringBuilder(); sb.append(dt.getYear()).append(dt.getMonthOfYear()).append(dt.getDayOfMonth()); return sb.toString(); }
From source file:com.inkubator.hrm.service.impl.ScheduleServiceImpl.java
@Scheduled(cron = "${cron.update.wt.holiday.date.where.is.every.year.equal.one}") @Transactional(readOnly = false, isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) @Override//from w w w . j a v a 2 s . c o m public void updateWtHolidayDateWhereIsEveryYearIsOne() throws Exception { LOGGER.info("Begin Running Update WtHoliday"); //ambil bulan dan taun januari sekarang DateTime monthAndYearNow = new DateTime(); List<WtHoliday> dataToUpdate = wtHolidayDao.getByYearDif(difWeekToDelete); LOGGER.info("Ukuran Data to Update " + dataToUpdate.size()); Date date = new Date(); WtHoliday newData; Long totalDuplicat; for (WtHoliday wtHoliday : dataToUpdate) { //ambil bulan dan tahun yang akan di update DateTime monthAndYearBefore = new DateTime(wtHoliday.getHolidayDate()); //jika tahun di database lebih kecil tahun sekarang if (monthAndYearBefore.getYear() < monthAndYearNow.getYear() && monthAndYearBefore.getMonthOfYear() >= monthAndYearNow.getMonthOfYear()) { // //cari nama + tahun, jika sudah ada skip, karena unik totalDuplicat = wtHolidayDao.getTotalWtHolidayByHolidayName( wtHoliday.getHolidayName() + " " + monthAndYearNow.getYear()); if (totalDuplicat == 0) { Date updateHolidayDate = DateTimeUtil.getDateFrom(wtHoliday.getHolidayDate(), 1, CommonUtilConstant.DATE_FORMAT_YEAR); newData = new WtHoliday(); newData.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(9))); newData.setHolidayName(wtHoliday.getHolidayName() + " " + monthAndYearNow.getYear()); newData.setIsColectiveLeave(wtHoliday.getIsColectiveLeave()); newData.setIsEveryYear(wtHoliday.getIsEveryYear()); if (wtHoliday.getReligion() != null) { newData.setReligion(wtHoliday.getReligion()); } newData.setCreatedBy(HRMConstant.INKUBA_SYSTEM); newData.setCreatedOn(new Date()); newData.setHolidayDate(updateHolidayDate); wtHolidayDao.save(newData); } } } LOGGER.info("Finish Running Update Wt Holiday"); }