當前位置: 首頁>>代碼示例>>Java>>正文


Java DateUtils.MILLIS_PER_DAY屬性代碼示例

本文整理匯總了Java中org.apache.commons.lang.time.DateUtils.MILLIS_PER_DAY屬性的典型用法代碼示例。如果您正苦於以下問題:Java DateUtils.MILLIS_PER_DAY屬性的具體用法?Java DateUtils.MILLIS_PER_DAY怎麽用?Java DateUtils.MILLIS_PER_DAY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.commons.lang.time.DateUtils的用法示例。


在下文中一共展示了DateUtils.MILLIS_PER_DAY屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getValueIn

public float getValueIn(final Field field) {
    final Calendar cal = Calendar.getInstance();
    cal.setTimeInMillis(0L);
    final Calendar cal2 = add(cal);
    final float millisDiff = cal2.getTimeInMillis() - cal.getTimeInMillis();
    switch (field) {
        case MILLIS:
            return millisDiff;
        case SECONDS:
            return millisDiff / DateUtils.MILLIS_PER_SECOND;
        case MINUTES:
            return millisDiff / DateUtils.MILLIS_PER_MINUTE;
        case HOURS:
            return millisDiff / DateUtils.MILLIS_PER_HOUR;
        case DAYS:
            return millisDiff / DateUtils.MILLIS_PER_DAY;
        case WEEKS:
            return millisDiff / (DateUtils.MILLIS_PER_DAY * 7);
        case MONTHS:
            return millisDiff / (DateUtils.MILLIS_PER_DAY * 30);
        case YEARS:
            return millisDiff / (DateUtils.MILLIS_PER_DAY * 365);
    }
    return 0F;
}
 
開發者ID:mateli,項目名稱:OpenCyclos,代碼行數:25,代碼來源:TimePeriod.java

示例2: getDaysBetween

/**
 * Returns the amount of days between two given dates
 */
public static Long getDaysBetween(Date beginDate, Date endDate) {
  final TimeZone tz = TimeZone.getDefault();
  final long nowDstOffset = (tz.inDaylightTime(beginDate)) ? tz.getDSTSavings() : 0L;
  final long dateDstOffset = (tz.inDaylightTime(endDate)) ? tz.getDSTSavings() : 0L;
  return (endDate.getTime() + dateDstOffset - beginDate.getTime() - nowDstOffset)
      / DateUtils.MILLIS_PER_DAY;
}
 
開發者ID:mauyr,項目名稱:openbravo-brazil,代碼行數:10,代碼來源:FIN_Utility.java

示例3: daysBetween

/**
 * Returns the number of days between 2 dates. Will be negative if date2 < date1, 0 if both are the same day or positive otherwise
 */
public static int daysBetween(Calendar date1, Calendar date2) {
    if (date1 == null || date2 == null) {
        return 0;
    }
    date1 = truncate(date1);
    date2 = truncate(date2);
    return (int) ((date2.getTimeInMillis() - date1.getTimeInMillis()) / DateUtils.MILLIS_PER_DAY);
}
 
開發者ID:mateli,項目名稱:OpenCyclos,代碼行數:11,代碼來源:DateHelper.java

示例4: checkAndSendAdmissionIntervalNotification

/**
 * This method will check the given program for admissions/referrals 
 * in the last "day". It will then send an email if any admission/referrals 
 * have been made in that timeframe.
 * 
 * The expectation is that a background thread will call this method, not
 * end-user-actions.
 */
public void checkAndSendAdmissionIntervalNotification(Program program) throws IOException {
	if (!enableEmailNotifications) return;

	InputStream is = null;
	String emailTemplate = null;
	try {
		is = WaitListManager.class.getResourceAsStream(WAIT_LIST_DAILY_ADMISSION_EMAIL_TEMPLATE_FILE);
		emailTemplate = IOUtils.toString(is);
	} finally {
		if (is != null) is.close();
	}
	
	String emailSubject = waitListProperties.getProperty("daily_admission_subject");

	// check if we need to run, might already have been run
	Date lastNotificationDate = program.getLastReferralNotification();
	// if first run, set default to a few days ago and let it sort itself out.
	if (lastNotificationDate == null) lastNotificationDate = new Date(System.currentTimeMillis() - (DateUtils.MILLIS_PER_DAY * 4));
	Date today = new Date();
	if (DateUtils.isSameDay(lastNotificationDate, today) || lastNotificationDate.after(today)) return;

	// get a list of the admissions between since last notification date.
	// send a notification for those admissions
	// update last notification date
	Date endDate = new Date(lastNotificationDate.getTime() + waitListNotificationPeriod);
	List<Admission> admissions = admissionDao.getAdmissionsByProgramAndAdmittedDate(program.getId(), lastNotificationDate, endDate);
	logger.debug("For programId=" + program.getId() + ", " + lastNotificationDate + " to " + endDate + ", admission count=" + admissions.size());

	ArrayList<AdmissionDemographicPair> admissionDemographicPairs = new ArrayList<AdmissionDemographicPair>();
	for (Admission admission : admissions) {
		AdmissionDemographicPair admissionDemographicPair = new AdmissionDemographicPair();
		admissionDemographicPair.setAdmission(admission);
		admissionDemographicPair.setDemographic(demographicDao.getDemographicById(admission.getClientId()));
		admissionDemographicPairs.add(admissionDemographicPair);
	}

	sendAdmissionNotification(emailSubject, emailTemplate, program, null, lastNotificationDate, endDate, admissionDemographicPairs);
	program.setLastReferralNotification(endDate);
	programDao.saveProgram(program);
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:48,代碼來源:WaitListManager.java

示例5: flushAllCached

public static synchronized void flushAllCached() {
	ruleBaseInstances = new QueueCache<String, RuleBase>(4, 2048, DateUtils.MILLIS_PER_DAY, null);
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:3,代碼來源:RuleBaseFactory.java

示例6: getApplicationStatus

@Override
public ApplicationStatusVO getApplicationStatus() {
    final ApplicationStatusVO vo = new ApplicationStatusVO();

    // Uptime period
    final long diff = System.currentTimeMillis() - startupTime;
    final int days = (int) (diff / DateUtils.MILLIS_PER_DAY);
    final int hours = (int) ((diff % DateUtils.MILLIS_PER_DAY) / DateUtils.MILLIS_PER_HOUR);
    vo.setUptimeDays(days);
    vo.setUptimeHours(hours);

    // Connected users
    SessionQuery sessions = new SessionQuery();
    sessions.setGroups(permissionService.getAllVisibleGroups());
    sessions.setPageForCount();

    sessions.setNatures(Collections.singleton(Group.Nature.ADMIN));
    vo.setConnectedAdmins(PageHelper.getTotalCount(accessService.searchSessions(sessions)));

    sessions.setNatures(Collections.singleton(Group.Nature.MEMBER));
    vo.setConnectedMembers(PageHelper.getTotalCount(accessService.searchSessions(sessions)));

    sessions.setNatures(Collections.singleton(Group.Nature.BROKER));
    vo.setConnectedBrokers(PageHelper.getTotalCount(accessService.searchSessions(sessions)));

    sessions.setNatures(Collections.singleton(Group.Nature.OPERATOR));
    vo.setConnectedOperators(PageHelper.getTotalCount(accessService.searchSessions(sessions)));

    // Cyclos version
    vo.setCyclosVersion(getCyclosVersion());

    // Number of alerts
    vo.setMemberAlerts(alertService.getAlertCount(Alert.Type.MEMBER));
    vo.setSystemAlerts(alertService.getAlertCount(Alert.Type.SYSTEM));
    vo.setErrors(errorLogService.getCount());

    // Unread messages
    vo.setUnreadMessages(countUnreadMessages());

    // Open invoices
    vo.setOpenInvoices(countOpenInvoices());

    return vo;
}
 
開發者ID:mateli,項目名稱:OpenCyclos,代碼行數:44,代碼來源:ApplicationServiceImpl.java


注:本文中的org.apache.commons.lang.time.DateUtils.MILLIS_PER_DAY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。