Package org.joda.time

Examples of org.joda.time.DateMidnight.toDate()


        // calculate series
        int index = 1;
        DateMidnight date = startDate.plusDays(1);
        while (date.compareTo(endDate) <= 0)
        {
            dates[index] = date.toDate();

            long thisValuation = security.getSecurityPrice(date.toDate()).getValue();
            long thisDelta = thisValuation - valuation;

            delta[index] = (double) thisDelta / (double) valuation;
View Full Code Here


        DateMidnight date = startDate.plusDays(1);
        while (date.compareTo(endDate) <= 0)
        {
            dates[index] = date.toDate();

            long thisValuation = security.getSecurityPrice(date.toDate()).getValue();
            long thisDelta = thisValuation - valuation;

            delta[index] = (double) thisDelta / (double) valuation;
            accumulated[index] = ((accumulated[index - 1] + 1 - adjustment) * (delta[index] + 1)) - 1 + adjustment;

View Full Code Here

    private void initEmpty(PerformanceIndex clientIndex)
    {
        DateMidnight startDate = clientIndex.getFirstDataPoint().toDateMidnight();

        dates = new Date[] { startDate.toDate() };
        delta = new double[] { 0d };
        accumulated = new double[] { 0d };
        transferals = new long[] { 0 };
        totals = new long[] { 0 };
    }
View Full Code Here

            if (date.getDayOfWeek() > DateTimeConstants.SATURDAY)
                continue;

            price = (long) ((double) price * ((random.nextDouble() * 0.2 - 0.1d) + 1));
            security.addPrice(new SecurityPrice(date.toDate(), price));
        }

        return this;
    }

View Full Code Here

        final DateTime lastFewMontInit = lastFewMontFinal.minusMonths(4); // 4 months, 4 + (1) last + 1 (current) = 6
        final List<Notification> fewMonth = filterByDate(lastFewMontInit.toDate(), lastFewMontFinal.toDate());
        // last year
        final DateTime lastYearFinal = lastFewMontInit.minusMinutes(1);
        final DateMidnight lastYeaInit = new DateMidnight(lastYearFinal).withWeekOfWeekyear(1).withDayOfWeek(1);
        final List<Notification> lastYear = filterByDate(lastYeaInit.toDate(), lastYearFinal.toDate());
        // long time ago
        final DateTime longTimeFinal = new DateTime(lastYeaInit).minusMinutes(1);
        final DateMidnight longTimeInit = new DateMidnight(longTimeFinal).minusYears(3).withWeekOfWeekyear(1).withDayOfWeek(1);
        final List<Notification> longtime = filterByDate(longTimeInit.toDate(), longTimeFinal.toDate());
        response.put(DateClasificatedEnum.TODAY, convertNotificationList(todayNotifications, request));
View Full Code Here

        final DateMidnight lastYeaInit = new DateMidnight(lastYearFinal).withWeekOfWeekyear(1).withDayOfWeek(1);
        final List<Notification> lastYear = filterByDate(lastYeaInit.toDate(), lastYearFinal.toDate());
        // long time ago
        final DateTime longTimeFinal = new DateTime(lastYeaInit).minusMinutes(1);
        final DateMidnight longTimeInit = new DateMidnight(longTimeFinal).minusYears(3).withWeekOfWeekyear(1).withDayOfWeek(1);
        final List<Notification> longtime = filterByDate(longTimeInit.toDate(), longTimeFinal.toDate());
        response.put(DateClasificatedEnum.TODAY, convertNotificationList(todayNotifications, request));
        response.put(DateClasificatedEnum.THIS_WEEK, convertNotificationList(thisWeekList, request));
        response.put(DateClasificatedEnum.THIS_MONTH, convertNotificationList(thisMonth, request));
        response.put(DateClasificatedEnum.LAST_MONTH, convertNotificationList(lastMonth, request));
        response.put(DateClasificatedEnum.FEW_MONTHS_AGO, convertNotificationList(fewMonth, request));
View Full Code Here

     * @return
     */
    //TODO: move to DateUtils
    public Date getCurrentdMidnightDate() {
        final DateMidnight midnightDate  = new DateTime().toDateMidnight();
        return midnightDate.toDate();
    }

    /**
     * Return the current date.
     * @return
 
View Full Code Here

        if (start.isBefore(end))
        {
            DateTime startOfDay = start.withTimeAtStartOfDay();
            DateMidnight endNextMidnight = end.plusDays(1).toDateMidnight();
            return query().filter("start.date >", startOfDay.toDate())
                    .filter("start.date <", endNextMidnight.toDate()).list();
        }
        return Collections.emptyList();
    }

    /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.