Package org.joda.time

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


        final LocalDate ld = new LocalDate(2013,5,1);
        final LocalDateTime ldt = new LocalDateTime(2013,2,1,14,15,0);
        final DateTime dt = new DateTime(2013,2,1,14,15,0);
        final String s = "New string";
       
        argRepr.mapPut("localDateProperty.value", asIsoNoT(ld.toDate()));
        argRepr.mapPut("localDateTimeProperty.value", asIso(ldt.toDate()));
        argRepr.mapPut("dateTimeProperty.value", asIso(dt.toDate()));
        argRepr.mapPut("stringProperty.value", s);

        final RestfulResponse<JsonRepresentation> result = client.follow(updateLink, argRepr);
View Full Code Here


        final RestfulResponse<JsonRepresentation> result = client.follow(updateLink, argRepr);
        assertThat(result.getStatus(), is(HttpStatusCode.OK));
       
        final DomainObjectRepresentation afterResp = result.getEntity().as(DomainObjectRepresentation.class);
       
        assertThat(afterResp.getProperty("localDateProperty").getDate("value"), is(ld.toDate()));
        assertThat(afterResp.getProperty("localDateTimeProperty").getDateTime("value"), is(ldt.toDate()));
        assertThat(afterResp.getProperty("dateTimeProperty").getDateTime("value"), is(dt.toDate()));
        assertThat(afterResp.getProperty("stringProperty").getString("value"), is(s));
    }
   
View Full Code Here

    public void jodaPropertiesUpdated() throws Exception {
       
        // LocalDate
        final LocalDate ld = new LocalDate(2013,5,1);
        modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "localDateProperty");
        argRepr = modifyLink.getArguments().mapPut("value", asIsoNoT(ld.toDate()));
        assertThat(followedRepr(modifyLink,argRepr).getDate("value"), is(ld.toDate()));


        // LocalDateTime
        final LocalDateTime ldt = new LocalDateTime(2013,2,1,14,15,0);
View Full Code Here

       
        // LocalDate
        final LocalDate ld = new LocalDate(2013,5,1);
        modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "localDateProperty");
        argRepr = modifyLink.getArguments().mapPut("value", asIsoNoT(ld.toDate()));
        assertThat(followedRepr(modifyLink,argRepr).getDate("value"), is(ld.toDate()));


        // LocalDateTime
        final LocalDateTime ldt = new LocalDateTime(2013,2,1,14,15,0);
        modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "localDateTimeProperty");
View Full Code Here

    private DateTimeFormatter fmt = ISODateTimeFormat.date();
   
    @Override
    public byte[] convertToNoSqlImpl(Object value) {
      LocalDate dt = (LocalDate) value;
      long milliseconds = dt.toDate().getTime();
      return StandardConverters.convertToBytes(milliseconds);
    }

    @Override
    public Object convertFromNoSqlImpl(byte[] value) {
View Full Code Here

            setCellValueForDate(cell, date, dateCellStyle);
            return true;
        }
        if(valueAsObj instanceof LocalDateTime) {
            LocalDateTime value = (LocalDateTime) valueAsObj;
            Date date = value.toDate();
            setCellValueForDate(cell, date, dateCellStyle);
            return true;
        }
        if(valueAsObj instanceof DateTime) {
            DateTime value = (DateTime) valueAsObj;
View Full Code Here

            setCellValueForDate(cell, date, dateCellStyle);
            return true;
        }
        if(valueAsObj instanceof DateTime) {
            DateTime value = (DateTime) valueAsObj;
            Date date = value.toDate();
            setCellValueForDate(cell, date, dateCellStyle);
            return true;
        }
       
        // number
View Full Code Here

     * @param date
     * @return date with any time component smaller than day set to zero
     */
    public Date startOfDay(Date date) {
        LocalDate day = new LocalDate(date.getTime());
        return day.toDate();
    }

    /**
     * Translates a message code based on current locale
     *
 
View Full Code Here

    @Override
    void apachePOI(POICell cell, Object value) {
      if (value != null) {
        LocalDate val = (LocalDate) value;
        cell.setCellType(Cell.CELL_TYPE_NUMERIC);
        cell.setCellValue(val.toDate());
      }
    }

  }
View Full Code Here

    private DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
   
    @Override
    public byte[] convertToNoSqlImpl(Object value) {
      LocalDate dt = (LocalDate) value;
      long milliseconds = dt.toDate().getTime();
      return StandardConverters.convertToBytes(milliseconds);
    }

    @Override
    public Object convertFromNoSqlImpl(byte[] value) {
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.