
how to take system date in java servlet?????

Hi Friend,
Try the following code:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class SystemDate extends HttpServlet {
public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
long time = System.currentTimeMillis();
Date date = new Date(time);
out.println(date.toString());
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.