Print current date & time - JSP Program

Q. Write a simple JSP program to print the current date and time.


The most important use of JSP is that we can use all the method available in core java. The Date class is available in java.util package.

Below program shows how to print the current date and time. We can use simple Date object with toString() to print current date and time.


            <fieldset style="width:20%; background-color: #ccffeb;">
                <legend><b><i>JSP Application<i><b></legend>
                <h3>Current Date and Time is :</h3>
                <% java.util.Date d = new java.util.Date();
                out.println(d.toString()); %>




date time