JSP Program for display Date

By: aathishankaran Viewed: 1382 times  Printer Friendly Format    

Here the program to display the date is given by executing this program we can get current date and time. Here the program shows you how to create a simple dynamic JSP page that prints the current date and time. 

So the following code accomplish this:

 <%@page contentType="text/html" import="java.util.*" %>
<!--  http://www.java-samples.com/jsp  -->  
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="460" bgcolor="#EEFFCA">
<td width="100%"><font size="6" color="#008000">&nbsp;Date Example</font></td>
<td width="100%"><b>&nbsp;Current Date and time is:&nbsp; <font color="#FF0000">
<%= new java.util.Date() %>

The main concept in this program is Date() function of the java.util package which returns the current data and time. 
 In the JSP Declaratives

<%@page contentType="text/html" import="java.util.*" %>

we are importing the java.util package and following JSP Expression code 

<%= new java.util.Date() %>

Most Viewed Articles (in JSP )

Latest Articles (in JSP)

Comment on this tutorial

Subscribe to Tutorials

Related Tutorials

Archived Comments

1. Yes it is exactly same as HTML. No change. In fact
View Tutorial          By: aathishankaran at 2008-08-03 05:22:38

2. This code was quite helpful .I wud like to ask cod
View Tutorial          By: Namrata at 2008-08-03 04:09:06

3. It's very useful..I like u
View Tutorial          By: jeeva at 2008-04-03 23:58:41

4. Thanks for good atricle. But this code will always
View Tutorial          By: Binod Suman at 2009-05-28 09:36:24

5. Thanks for good atricle. But this code will always
View Tutorial          By: Binod Suman at 2009-05-28 09:40:48

6. Hi Binod,

Since JSP code is execute

View Tutorial          By: Aathi at 2009-05-28 21:20:10

7. Thanks for the code it save's me a lot of work, ho
View Tutorial          By: Wishkah at 2009-09-04 00:29:16

8. Getting coding from this is very easy to me...
View Tutorial          By: shanmugaraja at 2009-09-09 01:50:02

9. I have my application running on server that is th
View Tutorial          By: vitamin b12 at 2009-12-04 10:51:56

10. Use (JavaScript) below code to display client dat
View Tutorial          By: pmprash at 2009-12-22 01:15:33

11. nice code....
nice explanation.. thanks

View Tutorial          By: vinitha at 2013-01-10 10:59:02

12. hey...i have a problem getting the system date in
View Tutorial          By: angel at 2010-04-03 09:27:38

13. Easiest way is to rearrange the date obtained to t
View Tutorial          By: Shahzad at 2010-07-11 21:15:14

14. Hello every body, i have made different codes of
View Tutorial          By: Sajjad Ali at 2010-07-27 03:50:16

15. Ya very good and easy code.
View Tutorial          By: Harikumar at 2010-09-24 00:33:16

16. hi.. how can i extrate day, month, year from date
View Tutorial          By: avkash at 2010-10-03 05:19:58

17. good code
View Tutorial          By: neha at 2011-07-02 01:44:38

18. good code
View Tutorial          By: neha at 2011-07-02 01:46:52

19. can we print only second by using the date functio
View Tutorial          By: mukesh kumar at 2011-07-27 02:31:02

20. What is this....for simple question every one was
View Tutorial          By: Kaify at 2011-07-27 21:35:52

21. What is this....for simple question every one was
View Tutorial          By: Kaify at 2011-07-27 21:35:55

22. What is this....for simple question every one was
View Tutorial          By: Kaify at 2011-07-27 21:36:25

23. Hei Kaify What is this????
if we get knowle

View Tutorial          By: Sooraj A.S at 2011-08-26 14:12:36

24. dai yaruda intha endu peru kaify and sooraj??? en
View Tutorial          By: sreelatha at 2011-10-03 09:31:54

25. Sooraj says right...
View Tutorial          By: Prabha at 2011-10-12 14:10:32

26. <%!
DateFormat date = DateFormat.getDat

View Tutorial          By: saifuctg at 2011-12-30 22:24:54

27. I just want to fetch system date without timing so
View Tutorial          By: dhanashri at 2012-04-04 02:09:36

28. only last code is gud one (DateFormat )... otherwi
View Tutorial          By: Gaurav at 2013-01-04 09:18:43

29. Hey i see some lines of code in order to displpay
View Tutorial          By: Bala at 2013-01-09 13:58:48

30. not bad
View Tutorial          By: JUST_PREET at 2013-03-06 11:37:15

31. It's good working very well...............
View Tutorial          By: avinash at 2013-03-07 09:38:21

32. Can Some body help me??
i want To show date

View Tutorial          By: saif at 2013-04-29 09:22:31

33. It is very helpful, I searched in many websites, b
View Tutorial          By: Anil Vaja at 2013-10-14 17:21:42

34. I keep listening to the news update lecture about
View Tutorial          By: Smithg960 at 2014-05-23 06:59:03

35. This code works for me. But i have a doubt how to
View Tutorial          By: Daya at 2015-05-04 12:04:19

36. <td><%=reportDelivery.getDateOrdered()%&g
View Tutorial          By: bindu at 2016-06-23 05:26:15

37. avadeya
View Tutorial          By: avadeya at 2017-01-07 03:39:27

38. ujuvqel
View Tutorial          By: ujuvqel at 2017-01-07 03:59:26

39. efekcaoksu
View Tutorial          By: efekcaoksu at 2017-01-07 04:48:06

40. itujiyth
View Tutorial          By: itujiyth at 2017-01-07 04:49:17

41. BrosFoow
View Tutorial          By: BrosFoow at 2017-03-30 07:08:31

42. hi i want to show the Calendar in text field when
View Tutorial          By: shivanaik at 2017-05-01 14:55:18