Package org.joda.time

Examples of org.joda.time.LocalDateTime


    }
   
    @Test
    public void roundtripWhenParsingDateTimeFormat() {
        final DateConverterForJodaLocalDateTime converter = new DateConverterForJodaLocalDateTime(settings, 0);
        final LocalDateTime dt = converter.convertToObject("2013-05-11 00:00", null);
        assertThat(dt, is(new LocalDateTime(2013, 05, 11, 0, 0)));
       
        final String str = converter.convertToString(dt, null);
        assertThat(str, is("2013-05-11 00:00"));
    }
View Full Code Here


    }
   
    @Test
    public void roundtripWhenParsingDateFormatWithAdjustBy() {
        final DateConverterForJodaLocalDateTime converter = new DateConverterForJodaLocalDateTime(settings, -1);
        final LocalDateTime dt = converter.convertToObject("2013-05-11", null);
        assertThat(dt, is(new LocalDateTime(2013, 05, 12, 0, 0)));
       
        final String str = converter.convertToString(dt, null);
        assertThat(str, is("2013-05-11 00:00"));
    }
View Full Code Here

    }

    @Test
    public void roundtripWhenParsingDateTimeFormatWithAdjustBy() {
        final DateConverterForJodaLocalDateTime converter = new DateConverterForJodaLocalDateTime(settings, -1);
        final LocalDateTime dt = converter.convertToObject("2013-05-11 00:00", null);
        assertThat(dt, is(new LocalDateTime(2013, 05, 12, 0, 0)));
       
        final String str = converter.convertToString(dt, null);
        assertThat(str, is("2013-05-11 00:00"));
    }
View Full Code Here

      // A customer object test entry
      Customer customerIn = new Customer();
      customerIn.name = "Felix";
      customerIn.address = "Kuestahler";
      customerIn.date = new Date();
      customerIn.date1 = new LocalDateTime();
      String customerInJSON = (new GsonWrapper()).getGson().toJson(customerIn);
     
      logger.log(Level.INFO, "Going to persist {0}", customerInJSON);
      StringWriter stringWriter = new StringWriter();
     
View Full Code Here

    if (runningPruner.compareAndSet(false, true) == false) {
      return;
    }

    try {
      LocalDateTime now = new LocalDateTime();
      List<Account> accounts = accountStore.getAll();

      for (Account account : accounts) {
        pruneEvents(now, account);
      }
View Full Code Here

  }

  private void pruneEvents(LocalDateTime now, Account account, EntityDocument<ApiRequest> document) {
    int days = account.getRetentionDays();
    ApiRequest apiRequest = document.getEntity();
    LocalDateTime later = apiRequest.getCreatedAt().plusWeeks(days);
    if (now.isAfter(later)) {
        apiRequestStore.deleteByDocumentId(
            document.getDocumentId(),
            document.getDocumentRevision()
        );
View Full Code Here

        super(LocalDateTime.class, datePattern, dateTimePattern, datePickerPattern, adjustBy);
    }

    @Override
    protected LocalDateTime doConvertToObject(String value, Locale locale) {
        LocalDateTime dateTime = convert(value);
        LocalDateTime adjustedDateTime = dateTime.minusDays(adjustBy);
        return adjustedDateTime;
    }
View Full Code Here

        return adjustedDateTime;
    }

    private LocalDateTime convert(String value) {
        try {
            final LocalDateTime dateTime = getFormatterForDateTimePattern().parseLocalDateTime(value);
            return dateTime;
        } catch(IllegalArgumentException ex) {
            try {
                final LocalDateTime dateTime = getFormatterForDatePattern().parseLocalDateTime(value);
                return dateTime;
            } catch(IllegalArgumentException ex2) {
                throw new ConversionException("Cannot convert into a date/time", ex);
            }
        }
View Full Code Here

        this.deep = facet.deep;
        this.awake = facet.awake;
        this.duration = facet.duration;
        this.quality = facet.quality;

        LocalDateTime localStartTime = new LocalDateTime(facet.start, DateTimeZone.forID(facet.tz));
        startMinute = localStartTime.getHourOfDay() * 60 + localStartTime.getMinuteOfHour();
        startTime = new TimeOfDayVO(startMinute, true);

        LocalDateTime localTimeAsleep= new LocalDateTime(asleep_time*1000, DateTimeZone.forID(facet.tz));
        timeAsleep = new TimeOfDayVO(localTimeAsleep.getHourOfDay()*60+localTimeAsleep.getMinuteOfHour(), true);

        LocalDateTime localTimeAwake= new LocalDateTime(awake_time*1000, DateTimeZone.forID(facet.tz));
        wakeUpTime = new TimeOfDayVO(localTimeAwake.getHourOfDay()*60+localTimeAwake.getMinuteOfHour(), true);

        LocalDateTime localEndTime = new LocalDateTime(facet.end, DateTimeZone.forID(facet.tz));
        endMinute = localEndTime.getHourOfDay() * 60 + localEndTime.getMinuteOfHour();
        endTime = new TimeOfDayVO(endMinute, true);

        timeSleeping = new DurationModel(duration);
        timeAwake = new DurationModel(awake);
    }
View Full Code Here

        this.title = facet.title;
        this.date = facet.date;
        this.start = facet.start;
        this.end = facet.end;

        LocalDateTime localStartTime = new LocalDateTime(facet.start, DateTimeZone.forID(facet.tz));
        startMinute = localStartTime.getHourOfDay() * 60 + localStartTime.getMinuteOfHour();
        startTime = new TimeOfDayVO(startMinute, true);

        LocalDateTime localEndTime = new LocalDateTime(facet.end, DateTimeZone.forID(facet.tz));
        endMinute = localEndTime.getHourOfDay() * 60 + localEndTime.getMinuteOfHour();
        endTime = new TimeOfDayVO(endMinute, true);

        this.details = facet.workoutDetails;
    }
View Full Code Here

TOP

Related Classes of org.joda.time.LocalDateTime

Copyright © 2018 www.massapicom. 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.