aspose file tools
The moose likes JSP and the fly likes Converting Date to String in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Converting Date to String in JSP" Watch "Converting Date to String in JSP" New topic
Author

Converting Date to String in JSP

Manoj Paul
Ranch Hand

Joined: Jan 18, 2007
Posts: 109
Please help....
wat should i do to convert Date to String in my JSP Page?
Thank you....
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1318

use Scriptlets(<% [java code] %>)and placing your java code between <% and %>.


Saifuddin..
[Linkedin] How To Ask Questions On JavaRanch My OpenSource
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1004
I would suggest the JSTL <fmt:formatDate> tag.
Or do the date formatting in a bean, and just get the property on the page.
The java class to use would be java.text.SimpleDateFormat.

Putting scriptlet code on a jsp page is generally not considered best practice
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1318

Originally posted by Stefan Evans:
do the date formatting in a bean, and just get the property on the page.
The java class to use would be java.text.SimpleDateFormat.

Putting scriptlet code on a jsp page is generally not considered best practice


indeed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting Date to String in JSP
 
Similar Threads
problem in date
struts bean:write tag with format key
[Struts] Various questions
converting java.sql.Date into GregorianCalendar or Calendar
change the date format from db to jsp