本文整理匯總了Java中org.apache.commons.lang.time.DateUtils.MILLIS_PER_HOUR屬性的典型用法代碼示例。如果您正苦於以下問題:Java DateUtils.MILLIS_PER_HOUR屬性的具體用法?Java DateUtils.MILLIS_PER_HOUR怎麽用?Java DateUtils.MILLIS_PER_HOUR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.commons.lang.time.DateUtils
的用法示例。
在下文中一共展示了DateUtils.MILLIS_PER_HOUR屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例2: report
public ActionForward report(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
// simple caching mechanism (because this report is open to the public and we don't want the public smacking our server around)
if (System.currentTimeMillis()-lastDataRetrievedTime>DateUtils.MILLIS_PER_HOUR)
{
lastDataRetrievedTime=System.currentTimeMillis();
// get attributes
currentDateTime = Calendar.getInstance().getTime();
shelterPopulation = populationReportManager.getShelterPopulation();
shelterUsage = populationReportManager.getShelterUsage();
mortalities = populationReportManager.getMortalities();
majorMedicalConditions = populationReportManager.getMajorMedicalConditions();
majorMentalIllnesses = populationReportManager.getMajorMentalIllnesses();
seriousMedicalConditions = populationReportManager.getSeriousMedicalConditions();
categoryCodeDescriptions = populationReportManager.getCategoryCodeDescriptions();
}
// set attributes
request.setAttribute("date", DateTimeFormatUtils.getStringFromDate(currentDateTime, DATE_FORMAT));
request.setAttribute("time", DateTimeFormatUtils.getStringFromTime(currentDateTime));
request.setAttribute("shelterPopulation", shelterPopulation);
request.setAttribute("shelterUsage", shelterUsage);
request.setAttribute("mortalities", mortalities);
request.setAttribute("majorMedicalConditions", majorMedicalConditions);
request.setAttribute("majorMentalIllnesses", majorMentalIllnesses);
request.setAttribute("seriousMedicalConditions", seriousMedicalConditions);
request.setAttribute("categoryCodeDescriptions", categoryCodeDescriptions);
// forward to view page
return mapping.findForward(REPORT);
}
示例3: 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;
}