本文整理匯總了Java中org.apache.commons.lang3.time.DateUtils.MILLIS_PER_SECOND屬性的典型用法代碼示例。如果您正苦於以下問題:Java DateUtils.MILLIS_PER_SECOND屬性的具體用法?Java DateUtils.MILLIS_PER_SECOND怎麽用?Java DateUtils.MILLIS_PER_SECOND使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.commons.lang3.time.DateUtils
的用法示例。
在下文中一共展示了DateUtils.MILLIS_PER_SECOND屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTime
/**
* Return the milliseconds of given date. Year, month and day fields are ignored.
*/
private long getTime(final Date date) {
final Calendar calendar = DateUtils.toCalendar(date);
return calendar.get(Calendar.HOUR_OF_DAY) * DateUtils.MILLIS_PER_HOUR + calendar.get(Calendar.MINUTE) * DateUtils.MILLIS_PER_MINUTE
+ calendar.get(Calendar.SECOND) * DateUtils.MILLIS_PER_SECOND + calendar.get(Calendar.MILLISECOND);
}
示例2: addCookie
/**
* Return the generated hash as cookie
*
* @param rb
* The {@link ResponseBuilder} to complete.
* @param login
* User login used to match the hash.
* @param hash
* The cookie value also stored in data base.
* @return the {@link ResponseBuilder} including cookie value. Same object
* than the original parameter.
*/
public ResponseBuilder addCookie(final ResponseBuilder rb, final String login, final String hash) {
if (hash != null) {
// There is a preference, add it to a cookie
final Date expire = new Date(System.currentTimeMillis() + COOKIE_AGE * DateUtils.MILLIS_PER_SECOND);
final NewCookie cookieHash = new NewCookie(PREFERRED_COOKIE_HASH, login + "|" + hash, "/", null, Cookie.DEFAULT_VERSION, null,
COOKIE_AGE, expire, true, true);
rb.cookie(cookieHash);
}
return rb;
}