Package org.joda.time

Examples of org.joda.time.DateTime.toLocalDate()


    public static LocalDate parseLocalDate(final String stringDate, final String pattern) {

        try {
            final DateTimeFormatter dateStringFormat = DateTimeFormat.forPattern(pattern);
            final DateTime dateTime = dateStringFormat.parseDateTime(stringDate);
            return dateTime.toLocalDate();
        } catch (final IllegalArgumentException e) {
            final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
            final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.date.pattern", "The parameter date ("
                    + stringDate + ") is invalid w.r.t. pattern " + pattern, "date", stringDate, pattern);
            dataValidationErrors.add(error);
View Full Code Here


        case VALUE_STRING:
            DateTime local = parseLocal(jp);
            if (local == null) {
                return null;
            }
            return local.toLocalDate();
        }
        throw ctxt.wrongTokenException(jp, JsonToken.START_ARRAY, "expected JSON Array, String or Number");
    }
}
View Full Code Here

    DateTime now = new DateTime();
    DateTime min = now.plusDays(7);
    DateTime max = now.plusMonths(1);
   
    Date minDate = min.toLocalDate().toDate();
    Date maxDate = max.toLocalDate().toDate();
   
    Set<Mother> mothers = motherDao.getMothersWithEddInRange(minDate, maxDate);
    Set<Mother>  mothersToSendReminder = new HashSet<Mother>();
   
    for (Mother mother : mothers) { 
View Full Code Here

  public Set<Mother> getMothersToRemindOnWeek() {
    DateTime now = new DateTime();
    DateTime max = now.plusWeeks(1);
   
    Date minDate = now.toLocalDate().toDate();
    Date maxDate = max.toLocalDate().toDate();
   
    Set<Mother> mothers = motherDao.getMothersWithEddInRange(minDate, maxDate);
    Set<Mother>  mothersToSendReminder = new HashSet<Mother>();
   
    for (Mother mother : mothers) { 
View Full Code Here

        Date dateVal = sql2o.createQuery(sql).executeScalar(Date.class);
        DateTime dateTimeVal = sql2o.createQuery(sql).executeScalar(DateTime.class);

        assertThat(new DateTime(dateVal).toLocalDate(), is(equalTo(new LocalDate())));
        assertThat(dateTimeVal.toLocalDate(), is(equalTo(new LocalDate())));
    }


    @Test
    public void testForIssue12ErrorReadingClobValue() {
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.