<%@ page language="java" import="java.util.*, java.text.*" %>
<%
String dateString = "2002-10-31 20:45:00";
DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date myDate = inputFormat.parse(dateString);

DateFormat outputFormat = new SimpleDateFormat("dd-MMMM-yyyy hh:mm:ss a");

String result = outputFormat.format(myDate);

%>
<%=result%>

see javadoc documentation on SimpleDateFormat for more info.

regards.

Gabriel

-----Mensaje original-----
De: Srinu.Reddy [mailto:srinu.reddy@;HBH.ILABSGROUP.COM]
Enviado el: martes, 05 de noviembre de 2002 12:33
Para: [EMAIL PROTECTED]
Asunto: Converting string to date format.


Hi All,

I am new to JSp programming.My problem is I am having a STRING which has a
date in it as (2002-10-31 20:45:00 ) but I want to display that in the
following format : (31-OCT-2002 08:45:00 PM). How can I do that?

Regards,

Srinu...

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to