This example will explain that the HttpServletResponse setDateHeader() method is used to set date with header name.in the example we use util package that will allow us to access the mandatory library for date initializing on the web browser as output.
<%@ page import=”java.util.*” %>
<html>
<head>
<title><dateHeader>In Jsp</title>
</head>
<body>
<center><br><b>
<%
long dt = new Date().getTime();
response.setDateHeader(“Date”, dt);
out.println(“Date is : “+response.getHeader(“Date”));
%></b></center></br>
</body>
</html>