Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners how to take system date in java servlet?????
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sandip gorde
how to take system date in java servlet?????
1 Answer(s)      4 years ago
Posted in : Java Beginners


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


Advertisement
View Answers

December 6, 2010 at 3:43 PM


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



Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com