How to print a date using JSP Expression?


Following example shows a JSP Expression printing date on the browser −

<html>
   <head>
      <title>A Comment Test</title>
   </head>
   <body>
      <p>Today's date: <%= (new java.util.Date()).toLocaleString()%></p>
   </body>
</html>

The above code will generate the following result −

Today's date: 11-Sep-2010 21:24:25

Updated on: 30-Jul-2019

249 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements