Write a program to find the current date and time using JSP..

Mumbai University > information technology > sem 4> Web Programming

Marks: 5M

Year : Dec16

1 Answer

Getting Current Date & Time

This is very easy to get current date and time in JSP program. You can use a simple Date object with toString() method to print current date and time as follows:

<%@ page import="java.io.*,java.util.*, javax.servlet.*" %>
<title>Display Current Date & Time</title>
<h1>Display Current Date & Time</h1>
   Date date = new Date();
   out.print( "<h2 align=\"center\">" +date.toString()+"</h2>");
Please log in to add an answer.