Vinu
Yeah, you are right about it, I can't get getDateHeader working.

For the solution one, I have setup like this for jsp and worked.

<%@ page session="false" %>
<html>
   <head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <title><%= application.getServerInfo() %></title>
</head>
<body>
Current Time:
<%
out.println("<SCRIPT LANGUAGE=JavaScript>");
out.println("var currentTime = new Date();");
out.println("document.write(currentTime.toLocaleString());");
out.println("</SCRIPT>");
out.println("</HEAD>");
%>
</body>
</html>

SK
----- Original Message ----- From: "Vinu Varghese" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Tuesday, July 11, 2006 1:24 AM
Subject: Re: Getting the date/time from the client


Thanks SK,

I tried the second solution , but request.getDateHeader("Date") returns -1 .

Also I didn't understand the first solution ( embed a javascript), Can u
pls elaborate that.

Thanks and regards
Vinu

Shinya Koizumi wrote:
One is to embed javascript in the output

out.println("<HTML><HEAD><title>JavaScriptExample</title>");
    out.println("<SCRIPT LANGUAGE=JavaScript>");
    out.println("function back() {");
    out.println("history.back(-1);");
    out.println("}");
    out.println("</SCRIPT>");
    out.println("</HEAD>");


The other solution is to get it from the request header.

protected void doGet(HttpServletRequest request, HttpServletResponse
response)
        throws ServletException, IOException {
    long l = request.getDateHeader("Date");
    Date d = new Date(l);
    System.out.println(d);
}

SK
----- Original Message ----- From: "Vinu Varghese" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Tuesday, July 11, 2006 12:51 AM
Subject: Getting the date/time from the client


Hi All,

I am doing a project in jsp/servlet and tomcat, which requires to take
the client date/time (ie the time of the machine the browser is
running). Is there any way to accomplish this ?

Thanks & regards
Vinu



--
........................................

Vinu Varghese
[EMAIL PROTECTED]
www.x-minds.org





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
........................................

Vinu Varghese
[EMAIL PROTECTED]
www.x-minds.org





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to