Example usage for org.joda.time DateMidnight DateMidnight

List of usage examples for org.joda.time DateMidnight DateMidnight

Introduction

In this page you can find the example usage for org.joda.time DateMidnight DateMidnight.

Prototype

public DateMidnight(Object instant) 

Source Link

Document

Constructs an instance from an Object that represents a datetime.

Usage

From source file:com.liteoc.logic.expressionTree.ArithmeticOpNode.java

License:LGPL

private String calculateGenericDate(String value1, String value2) {
    DateMidnight dm = new DateMidnight(ExpressionTreeHelper.getDate(value1).getTime());
    DateTimeFormatter fmt = ISODateTimeFormat.date();
    switch (op) {
    case PLUS: {//from   ww w.  j a va2  s.  c o m
        dm = dm.plusDays(Double.valueOf(value2).intValue());
        return fmt.print(dm);
    }
    case MINUS: {
        dm = dm.minusDays(Double.valueOf(value2).intValue());
        return fmt.print(dm);
    }
    default:
        return null; // Bad operator!
    }
}

From source file:com.manydesigns.portofino.calendar.AbstractMonthView.java

License:Open Source License

public AbstractMonthView(DateTime referenceDateTime, int firstDayOfWeek) {
    logger.debug("Initializing month");
    this.referenceDateTime = referenceDateTime;
    logger.debug("Reference date time: {}", referenceDateTime);
    this.firstDayOfWeek = firstDayOfWeek;
    logger.debug("First day of week: {}", firstDayOfWeek);

    referenceDateMidnight = new DateMidnight(referenceDateTime);
    referenceYear = referenceDateTime.getYear();
    referenceMonth = referenceDateTime.getMonthOfYear();

    monthStart = referenceDateMidnight.withDayOfMonth(1);
    monthEnd = monthStart.plusMonths(1);
    monthInterval = new Interval(monthStart, monthEnd);

    monthViewStart = monthStart.withDayOfWeek(firstDayOfWeek);
    monthViewEnd = monthViewStart.plusWeeks(6);
    monthViewInterval = new Interval(monthViewStart, monthViewEnd);
    logger.debug("Month view start: {}", monthViewStart);

    logger.debug("Initializing weeks");
    weeks = createWeeksArray(6);//  w w w. jav  a 2s. com
    DateMidnight weekStart = monthViewStart;
    for (int i = 0; i < weeks.length; i++) {
        DateMidnight weekEnd = weekStart.plusWeeks(1);
        weeks[i] = createWeek(weekStart, weekEnd);

        weekStart = weekEnd;
    }
}

From source file:com.manydesigns.portofino.pageactions.calendar.AgendaView.java

License:Open Source License

public AgendaView(DateTime referenceDateTime) {
    firstDay = new DateMidnight(referenceDateTime);
}

From source file:com.manydesigns.portofino.pageactions.calendar.AgendaView.java

License:Open Source License

public int addEvent(Event event) {
    DateMidnight day = new DateMidnight(event.getInterval().getStart());
    DateTime end = event.getInterval().getEnd();
    int added = 0;
    while (end.minus(1).compareTo(day) >= 0) {
        if (addEvent(day, event)) {
            added++;//from  w  w  w.  j a va  2  s  . c  o  m
        }
        day = day.plusDays(1);
    }
    return added;
}

From source file:com.naver.mage4j.core.util.PhpDateUtils.java

License:Open Source License

public static Date getFirstDayOfMinusMonth(Date date) {
    return new DateMidnight(date).minusMonths(1).withDayOfMonth(1).toDate();
}

From source file:com.naver.mage4j.core.util.PhpDateUtils.java

License:Open Source License

public static Date getLastDayOfMinusMonth(Date date) {
    return new DateMidnight(date).withDayOfMonth(1).minusDays(1).toDate();
}

From source file:com.naver.mage4j.core.util.PhpDateUtils.java

License:Open Source License

public static Date getFirstDayOfMinusMonth(String yyyyMM) throws ParseException {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMM");
    Date date = dateFormat.parse(yyyyMM);

    return new DateMidnight(date).minusMonths(1).withDayOfMonth(1).toDate();
}

From source file:com.naver.mage4j.core.util.PhpDateUtils.java

License:Open Source License

public static Date getLastDayOfMinusMonth(String yyyyMM) throws ParseException {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMM");
    Date date = dateFormat.parse(yyyyMM);

    return new DateMidnight(date).withDayOfMonth(1).minusDays(1).toDate();
}

From source file:com.sapienter.jbilling.server.process.BusinessDays.java

License:Open Source License

private boolean isEqual(Date startDate, Date endDate) {
    return new DateMidnight(startDate).equals(new DateMidnight(endDate));
}

From source file:com.sapienter.jbilling.server.process.PeriodOfTime.java

License:Open Source License

public PeriodOfTime(Date start, Date end, int dayInCycle, int position) {
    this.start = start != null ? new DateMidnight(start.getTime()) : null;
    this.end = end != null ? new DateMidnight(end.getTime()) : null;
    this.position = position;
    this.daysInCycle = dayInCycle;
}