Package org.joda.time

Examples of org.joda.time.LocalDateTime.toDateTime()


        assertThat(scalarRepr.isString(), is(true));

        final LocalDateTime expected = new LocalDateTime(2009, 4, 29, 13, 45, 22);

        assertThat(scalarRepr.asDateTime(), is(expected.toDate()));
        assertThat(scalarRepr.asString(), is(ISODateTimeFormat.dateTimeNoMillis().withZoneUTC().print(expected.toDateTime())));

        // and then member types have links to details (selected ones inspected only)
        property = domainObjectRepr.getProperty("localDateProperty");
        assertThat(property.getLinkWithRel(Rel.DETAILS),
                isLink()
View Full Code Here


        return d.toDateMidnight().getMillis();
    }

    public static long toMillis(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute) {
        LocalDateTime d = new LocalDateTime(year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute);
        return d.toDateTime().getMillis();
    }

}
View Full Code Here

        if (data instanceof DateTime) {
            DateTime dateTime = (DateTime) data;
            milliSeconds = dateTime.getMillis();
        } else if (data instanceof LocalDateTime) {
            LocalDateTime date = (LocalDateTime) data;
            milliSeconds = date.toDateTime().toDate().getTime();
        } else {
            throw new ConversionException(data.getClass());
        }
        return new NonNestedOutboundVariable("new Date(" + milliSeconds + ")");
    }
View Full Code Here

          value = new ShortBlob(bValue);
        }
      } else if (type.equals(EdmSimpleType.DATETIME)) {
        LocalDateTime dValue = (LocalDateTime) value;
        if (dValue != null) {
          value = dValue.toDateTime().toDate(); // TODO review
        }
      }
      e.setProperty(prop.getName(), value);
    }
  }
View Full Code Here

  @Test
  public void testTurnOffTrueDayOfWeek() {
    LocalDateTime time = new LocalDateTime().withDayOfWeek(
        DateTimeConstants.SATURDAY).withHourOfDay(12);

    DateTimeUtils.setCurrentMillisFixed(time.toDateTime().toInstant()
        .getMillis());

    Assert.assertTrue("Should have been true for Saturday, 12:00 PM: ",
        this.criteria.shouldTurnOff());
View Full Code Here

  public void testTurnOffTrueTimeOfDay() {
    LocalDateTime timeEarly = new LocalDateTime().withDayOfWeek(
        DateTimeConstants.WEDNESDAY).withHourOfDay(19).withMonthOfYear(
        01); //Wednesday, 6:59 AM

    DateTimeUtils.setCurrentMillisFixed(timeEarly.toDateTime().toInstant()
        .getMillis());

    Assert.assertTrue("Should have been true for Wednesday, 6:59 AM: ",
        this.criteria.shouldTurnOff());
View Full Code Here

    LocalDateTime timeLate = new LocalDateTime().withDayOfWeek(
        DateTimeConstants.WEDNESDAY).withHourOfDay(19).withMonthOfYear(
        01); //Wednesday, 7:01 PM

    DateTimeUtils.setCurrentMillisFixed(timeLate.toDateTime().toInstant()
        .getMillis());

    Assert.assertTrue("Should have been true for Wednesday, 7:01 PM: ",
        this.criteria.shouldTurnOff());
  }
View Full Code Here

  @Test
  public void testTurnOffFalse() {
    LocalDateTime time = new LocalDateTime().withDayOfWeek(
        DateTimeConstants.WEDNESDAY).withHourOfDay(12);

    DateTimeUtils.setCurrentMillisFixed(time.toDateTime().toInstant()
        .getMillis());

    Assert.assertFalse("Should have been false for Wednesday, 12:00 PM: ",
        this.criteria.shouldTurnOff());
View Full Code Here

    }

    @Test
    public void Set() throws SQLException {
        LocalDateTime value = new LocalDateTime();
        DateTime dt = value.toDateTime(DateTimeZone.UTC);
        Timestamp ts = new Timestamp(dt.getMillis());

        PreparedStatement stmt = EasyMock.createNiceMock(PreparedStatement.class);
        stmt.setTimestamp(0, ts, UTC);
        EasyMock.replay(stmt);
View Full Code Here

    public DateTime normalizeDateToInfusionsoft(Date date, TimeZone originTimeZone){
        final DateTimeZone otz = forTimeZone(originTimeZone);
        final LocalDateTime local = new LocalDateTime(date.getTime(), otz);

        return local.toDateTime(est);
    }

    public Date normalizeDateToInfusionsoftDate(DateTime date){
        return date.toDateTime(est).toDate();
    }
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.