JSP Program for display Date
By: aathishankaran
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
-->
<html>
<body>
<p> </p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0"
width="460" bgcolor="#EEFFCA">
<tr>
<td width="100%"><font size="6"
color="#008000"> Date Example</font></td>
</tr>
<tr>
<td width="100%"><b> Current Date and time
is: <font color="#FF0000">
<%= new java.util.Date() %>
</font></b></td>
</tr>
</table>
</center>
</div>
</body>
</html>
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() %>
Archived Comments
1. hi i want to show the Calendar in text field when the user enter into that text box please help me o
View Tutorial By: shivanaik at 2017-05-01 14:55:18
2. BrosFoow
View Tutorial By: BrosFoow at 2017-03-30 07:08:31
3. itujiyth
View Tutorial By: itujiyth at 2017-01-07 04:49:17
4. efekcaoksu
View Tutorial By: efekcaoksu at 2017-01-07 04:48:06
5. ujuvqel
View Tutorial By: ujuvqel at 2017-01-07 03:59:26
6. avadeya
View Tutorial By: avadeya at 2017-01-07 03:39:27
7. <td><%=reportDelivery.getDateOrdered()%></td>
this is giving me the Mon Jul
View Tutorial By: bindu at 2016-06-23 05:26:15
8. This code works for me. But i have a doubt how to develop a Ajax program that gets the user input f
View Tutorial By: Daya at 2015-05-04 12:04:19
9. I keep listening to the news update lecture about receiving boundless online grant applications so I
View Tutorial By: Smithg960 at 2014-05-23 06:59:03
10. It is very helpful, I searched in many websites, but this post helped me the most to show date in js
View Tutorial By: Anil Vaja at 2013-10-14 17:21:42
11. Can Some body help me??
i want To show date like "29. Apr 2013"
i m using Fo
View Tutorial By: saif at 2013-04-29 09:22:31
12. It's good working very well...............
View Tutorial By: avinash at 2013-03-07 09:38:21
13. not bad
View Tutorial By: JUST_PREET at 2013-03-06 11:37:15
14. nice code....
nice explanation.. thanks
View Tutorial By: vinitha at 2013-01-10 10:59:02
15. Hey i see some lines of code in order to displpay the system time where server is in another timezon
View Tutorial By: Bala at 2013-01-09 13:58:48
16. only last code is gud one (DateFormat )... otherwise all is rubbish...
View Tutorial By: Gaurav at 2013-01-04 09:18:43
17. I just want to fetch system date without timing so how can i do that?
View Tutorial By: dhanashri at 2012-04-04 02:09:36
18. <%!
DateFormat date = DateFormat.getDateInstance
(DateFormat.FULL, Locale.US);
View Tutorial By: saifuctg at 2011-12-30 22:24:54
19. Sooraj says right...
View Tutorial By: Prabha at 2011-10-12 14:10:32
20. dai yaruda intha endu peru kaify and sooraj??? en kaiyla rendu perum kedachinga .................
View Tutorial By: sreelatha at 2011-10-03 09:31:54
21. Hei Kaify What is this????
if we get knowledge from any resource,it is always very good....
View Tutorial By: Sooraj A.S at 2011-08-26 14:12:36
22. What is this....for simple question every one was commenting.....and unnecessarily praising...gud co
View Tutorial By: Kaify at 2011-07-27 21:36:25
23. What is this....for simple question every one was commenting.....and unnecessarily praising...gud co
View Tutorial By: Kaify at 2011-07-27 21:35:55
24. What is this....for simple question every one was commenting.....and unnecessarily praising...gud co
View Tutorial By: Kaify at 2011-07-27 21:35:52
25. can we print only second by using the date function?
View Tutorial By: mukesh kumar at 2011-07-27 02:31:02
26. good code
View Tutorial By: neha at 2011-07-02 01:46:52
27. good code
View Tutorial By: neha at 2011-07-02 01:44:38
28. hi.. how can i extrate day, month, year from date function
View Tutorial By: avkash at 2010-10-03 05:19:58
29. Ya very good and easy code.
View Tutorial By: Harikumar at 2010-09-24 00:33:16
30. Hello every body, i have made different codes of JSP page but i am getting trouble on GOOGLE CHROME
View Tutorial By: Sajjad Ali at 2010-07-27 03:50:16
31. Easiest way is to rearrange the date obtained to the format in which we can save in the backend.
View Tutorial By: Shahzad at 2010-07-11 21:15:14
32. hey...i have a problem getting the system date in jsp and putting that date back into the oracle dat
View Tutorial By: angel at 2010-04-03 09:27:38
33. Use (JavaScript) below code to display client date and time on web page
<
View Tutorial By: pmprash at 2009-12-22 01:15:33
34. I have my application running on server that is there in some other time zone. I need to display the
View Tutorial By: vitamin b12 at 2009-12-04 10:51:56
35. Getting coding from this is very easy to me...
View Tutorial By: shanmugaraja at 2009-09-09 01:50:02
36. Thanks for the code it save's me a lot of work, however how can i delete the timezone.
View Tutorial By: Wishkah at 2009-09-04 00:29:16
37. Hi Binod,
Since JSP code is executed at the server side before sending back to the br
View Tutorial By: Aathi at 2009-05-28 21:20:10
38. Thanks for good atricle. But this code will always show the client page time NOT server current time
View Tutorial By: Binod Suman at 2009-05-28 09:40:48
39. Thanks for good atricle. But this code will always show the client page time NOT server current time
View Tutorial By: Binod Suman at 2009-05-28 09:36:24
40. Yes it is exactly same as HTML. No change. In fact you can convert any existing HTML page to a JSP p
View Tutorial By: aathishankaran at 2008-08-03 05:22:38
41. This code was quite helpful .I wud like to ask code for making text fields for username and password
View Tutorial By: Namrata at 2008-08-03 04:09:06
42. It's very useful..I like u
View Tutorial By: jeeva at 2008-04-03 23:58:41
Comment on this tutorial