Package org.joda.time

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


     * </p>
     */
    @Scheduled(cron = "0 0 1 * * ?")
    public void removeNotActivatedUsers() {
        DateTime now = new DateTime();
        List<User> users = userRepository.findNotActivatedUsersByCreationDateBefore(now.minusDays(3));
        for (User user : users) {
            log.debug("Deleting not activated user {}", user.getLogin());
            userRepository.delete(user);
        }
    }
View Full Code Here


    @Test
    public void testFindNotActivatedUsersByCreationDateBefore() {
        userService.removeNotActivatedUsers();
        DateTime now = new DateTime();
        List<User> users = userRepository.findNotActivatedUsersByCreationDateBefore(now.minusDays(3));
        assertThat(users).isEmpty();
    }

    private void generateUserToken(User user, String tokenSeries, LocalDate localDate) {
        PersistentToken token = new PersistentToken();
View Full Code Here

    private void setOffsetDays(int startOffset, int endOffset) {
        setCaption(DEFAULT_CAPTION);
        DateTime today = getValue() != null ? new DateTime(getValue().getTime())  : new DateTime();
        Date end = today.plusDays(startOffset).toDate();
        Date start = today.minusDays(endOffset).toDate();
        setValue(today.toDate());
        setDateFormat("yyyy-MM-dd");
        setRangeStart(start);
        setRangeEnd(end);
        setDateOutOfRangeMessage(OUT_OF_RANGE_MESSAGE);
View Full Code Here

     */
    public static String isoHourEndingToIsoDay(String isoHour) {
        DateTime dt = isoToDateTime(isoHour);
        dt = dt.withZone(SSTimeUtil.getMarketTimeZone());
        if (dt.getHourOfDay() == 0) {
            dt = dt.minusDays(1);
        }
        return dateTimeToIsoDay(dt);
    }

    /**
 
View Full Code Here

    // make the invocation age in database, by updating it.
    DateTime dateTime = new DateTime();
    JdbcTemplate jdbcTemplate = dao.getJdbcTemplate();
    for (int days = 1; days <= 14; days++) {
      jdbcTemplate.update("update library.webservice_history set invocation_time = ?",
          new Object[]{dateTime.minusDays(days).toDate()});
      boolean isAllowed = dao.isWebserviceInvocationAllowed(similarTrack);
      boolean cacheIsInvalid = days > SIMILAR.getDaysToCache();
      assertTrue(isAllowed == cacheIsInvalid);
    }
  }
View Full Code Here

  private Set<String> loadRecentFluxDomains(long startTime) {
    Set<String> retval = new HashSet<String>();
    DBInterface iface = DBInterfaceFactory.loadDBInterface();
    DateTime startDateTime = new DateTime(startTime * 1000);
    for(int i = 1; i < 8; i++){
      Date prevdate = new Date(startDateTime.minusDays(i).getMillis());
      try{
        for(StoredDomainCluster fluxCluster: iface.getClusters(prevdate,
            ClusterClass.FLUX)){
          for(String domain : fluxCluster.getDomains()){
            retval.add(DomainNameUtils.extractEffective2LD(domain));
View Full Code Here

   *
   * @param adate the date of the first clustering run
   */
  public void updateClusterSimilarities(Date adate){
    DateTime adt = new DateTime(adate.getTime());
    Date bdate = new Date(adt.minusDays(1).getMillis());
    this.updateClusterSimilarities(adate, bdate);
  }
 
 
  /**
 
View Full Code Here

            defaultVal = dateTimeFormatter.print(dateTime);
        }
        else        if (defaultVal.startsWith("d")) {
            DateTime dateTime = new DateTime();
            Integer days = Integer.parseInt(defaultVal.substring(1,defaultVal.length()));
            dateTime =     dateTime.minusDays(days);
            defaultVal = dateTimeFormatter.print(dateTime);
        }


        return defaultVal;
View Full Code Here

            } else if (dt.getMinuteOfHour() != 0) {
                return dt.minusMinutes(1);
            } else if (dt.getHourOfDay() != 0) {
                return dt.minusHours(1);
            } else {
                return dt.minusDays(1);
            }
        default:
            return null;
        }
View Full Code Here

    if(selectedMode == SelectionMode.DAY)
      if(this.cboDay.getDate() != null){
        DateTime selectedDate = new DateTime(this.cboDay.getDate());

        lowerBound = selectedDate.minusDays(this.numberOfPeriods);
      }
    else if(selectedMode == SelectionMode.WEEK)
      if(this.cboWeek.getSelectedItem() != null)
        lowerBound = ((Week)this.cboWeek.getSelectedItem()).getLowerBound();
    else if(selectedMode == SelectionMode.MONTH)
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.