Example usage for org.joda.time LocalDate toDateTimeAtStartOfDay

List of usage examples for org.joda.time LocalDate toDateTimeAtStartOfDay

Introduction

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

Prototype

public DateTime toDateTimeAtStartOfDay() 

Source Link

Document

Converts this LocalDate to a full datetime at the earliest valid time for the date using the default time zone.

Usage

From source file:graphene.util.time.JodaTimeUtil.java

License:Apache License

public static java.sql.Date toSQLDate(final LocalDate ld) {
    // TODO - confirm this conversion always works, esp. across timezones
    final java.sql.Date d = (ld == null ? null : new java.sql.Date(ld.toDateTimeAtStartOfDay().getMillis()));
    return d;/*  ww  w  .j  a  v a 2  s .com*/
}

From source file:julian.lylly.model.Task.java

/**
 * behaviour undefined if interval list is unsorted
 * any {@code null} input is interpreted as a non-bound in that direction
 * @param focusStart/*from ww  w  .  j  ava2s .c o m*/
 * @param focusEnd
 * @return
 */
public Duration getTimeSpentInInterval(LocalDate focusStart, LocalDate focusEnd) {
    Instant startInst, endInst;
    if (intervals.size() == 0 && !isActive()) { // #
        return Duration.ZERO;
    }
    if (focusStart == null) {
        startInst = intervals.size() == 0 ? starttime // != null because #
                : intervals.get(0).getStart().toInstant();
    } else {
        startInst = focusStart.toDateTimeAtStartOfDay().toInstant();
    }
    if (focusEnd == null) {
        endInst = isActive() ? Instant.now()
                //v intervals.size() != 0 because #
                : intervals.get(intervals.size() - 1).getEnd().toInstant();//TODO
    } else {
        endInst = focusEnd.toDateTimeAtStartOfDay().toInstant();
    }
    Interval focus = new Interval(startInst, endInst);

    return getTimeSpentInInterval(focus);
}

From source file:module.siadap.domain.util.SiadapMiscUtilClass.java

License:Open Source License

/**
 * /*from  w  ww  .  j  av a  2 s.  c o m*/
 * @param date
 *            the {@link LocalDate} that will be converted to represent the
 *            date at the beginning of the day
 * @return an {@link ReadableInstant} with the same day/month/year but the
 *         first instant of it, that is the first hour, first minute, first
 *         second etc...
 */
public static ReadableInstant convertDateToBeginOfDay(LocalDate date) {
    ReadableInstant newLocalDate = null;
    if (date != null) {
        return date.toDateTimeAtStartOfDay();
    }
    return newLocalDate;

}

From source file:net.rrm.ehour.util.DateUtil.java

License:Open Source License

public static String formatDate(LocalDate date, Locale dateLocale) {
    return formatDate(date.toDateTimeAtStartOfDay(), dateLocale);
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.accounting.PostingRulesManager.java

License:Open Source License

@Atomic
public static void createDEAStandaloneGratuityPostingRule(StandaloneInstallmentBean bean,
        DegreeCurricularPlan degreeCurricularPlan) {
    check(AcademicPredicates.MANAGE_PAYMENTS);

    DegreeCurricularPlanServiceAgreementTemplate dcpSAT = degreeCurricularPlan.getServiceAgreementTemplate();
    if (dcpSAT != null) {
        YearMonthDay startDate = bean.getStartDate();

        LocalDate startLocalDate = new LocalDate(startDate.getYear(), startDate.getMonthOfYear(),
                startDate.getDayOfMonth());
        BigDecimal ectsForYear = bean.getEctsForYear();
        BigDecimal gratuityFactor = bean.getGratuityFactor();
        BigDecimal ectsFactor = bean.getEctsFactor();

        new StandaloneEnrolmentGratuityPR(startLocalDate.toDateTimeAtStartOfDay(), null, dcpSAT, ectsForYear,
                gratuityFactor, ectsFactor);
    } else {/*from  w w  w.  j a va  2  s  .c  om*/
        throw new DomainException(
                "StandaloneEnrolmentGratuityPR.DegreeCurricularPlanServiceAgreementTemplate.cannot.be.null");
    }
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.serviceRequests.documentRequests.CreatePastDiplomaRequest.java

License:Open Source License

private static void process(PastDiplomaRequest request, LocalDate requestDate) {
    editSituation(request, AcademicServiceRequestSituationType.PROCESSING,
            requestDate.toDateTimeAtStartOfDay().plusMinutes(1));
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.serviceRequests.documentRequests.CreatePastDiplomaRequest.java

License:Open Source License

private static void send(PastDiplomaRequest request, LocalDate requestDate) {
    editSituation(request, AcademicServiceRequestSituationType.SENT_TO_EXTERNAL_ENTITY,
            requestDate.toDateTimeAtStartOfDay().plusMinutes(2));
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.serviceRequests.documentRequests.CreatePastDiplomaRequest.java

License:Open Source License

private static void receive(PastDiplomaRequest request, LocalDate requestDate) {
    editSituation(request, AcademicServiceRequestSituationType.RECEIVED_FROM_EXTERNAL_ENTITY,
            requestDate.toDateTimeAtStartOfDay().plusMinutes(3));
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.serviceRequests.documentRequests.CreatePastDiplomaRequest.java

License:Open Source License

private static void conclude(PastDiplomaRequest request, LocalDate emissionDate) {
    editSituation(request, AcademicServiceRequestSituationType.CONCLUDED,
            emissionDate.toDateTimeAtStartOfDay().plusMinutes(4));
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.serviceRequests.documentRequests.CreatePastDiplomaRequest.java

License:Open Source License

private static void deliver(PastDiplomaRequest request, LocalDate dispatchDate) {
    editSituation(request, AcademicServiceRequestSituationType.DELIVERED,
            dispatchDate.toDateTimeAtStartOfDay().plusMinutes(5));
}