R4R Team working to provide free of cost for experienced and freshers

Tutorials | Examples|Interview Questions and Answers|Java Tutorials| C Tutorials | C++ Tutorials | Spring Tutorials| Hibernate Tutorials | JSP Tutorials | Servelets Tutorials| C# Tutorials | PHP Tutorials etc , Basics | Download Software | Data Types | Variables | Constant | Storage & Classes | Operators | Decisions Making | Loops | Functions| Numbers | Arrays | Pointers | String | Datastructure | Expressions | Preprocessor Statement | I/O | Exception Handling | OOPs Tutorial | Classes and object |C++ Inheritance Overloading | Polymorphism | Abstraction | Encapsulation | Interfaces | Multithreading etc

JSP

JSP Projects

JSP Project

Display the current Date and Time
Previous Home Next

 

In this page of the tutorials we are going to show how to display the current date and time in the JSP page. for display the current date we call to the Date() function which is imported from the java.util.Date.* package.

 java.util.Date() It is used to display the current date and time of the system on the JSP page

 
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<p>&nbsp;</p>
<div align="center">
<center>
<table><tr><td><font color=red>Current Date is:</font>
</td>
<td><font><%= new java.util.Date() %></font></td>
</tr>
<tr><td>This is the Example of the JSP</td></tr>

</table>
</center>
</div>
</body>
</html>

Previous Home Next