APISonar


com.xiaoleilu.hutool.util.DateUtil.date

> com > xiaoleilu > hutool > util > DateUtil > date
com APIs xiaoleilu APIs hutool APIs util APIs DateUtil APIs date APIs

Example 1
public void setDateAndCache(long lastModify, int httpCacheSeconds) {
		SimpleDateFormat formatter = new SimpleDateFormat(DateUtil.HTTP_DATETIME_PATTERN, Locale.US);
		formatter.setTimeZone(TimeZone.getTimeZone("GMT"));

		// Date header
		Calendar time = new GregorianCalendar();
		setHeader(HttpHeaderNames.DATE.toString(), formatter.format(time.getTime()));

		// Add cache headers
		time.add(Calendar.SECOND, httpCacheSeconds);

		setHeader(HttpHeaderNames.EXPIRES.toString(), formatter.format(time.getTime()));
		setHeader(HttpHeaderNames.CACHE_CONTROL.toString(), "private, max-age=" + httpCacheSeconds);
		setHeader(HttpHeaderNames.LAST_MODIFIED.toString(), formatter.format(DateUtil.date(lastModify)));
	}