Date Format

hi everbody
my problem very simple but i don't anything about it
i take last_date coloum my query
(aaa.getString("last_date"))
and we use oracle so this format is 2000-01-01 00:00:00.0
iwant to use format dd/mm/yyyy
how do i do
Can you help me
Thankx
skychanAsked:
Who is Participating?
 
koppchaConnect With a Mentor Commented:
To Print on JSP you can do
<%
SimpleDateFormat sdf = new SimpleDateFormat(dd/MM/yyyy);
Date d = sdf.parse(aaa.getString("last_date")) ;
out.println(sdf.format(d));
%>
0
 
koppchaCommented:
SimpleDateFormat sdf = new SimpleDateFormat(dd/MM/yyyy);
Date d = sdf.parse(aaa.getString("last_date")) ;
System.out.println(sdf.format(d));
0
 
Jim CakalicSenior Developer/ArchitectCommented:
Hi,

I assume (given the topic) that this is in a JSP. If so, you could use the JSTL formatDate tag:

<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
...
    <jsp:useBean id="now" class="java.util.Date" />
    Date: <fmt:formatDate value="${now}" pattern="MM/dd/yyyy" />

Regards,
Jim Cakalic
0
 
koppchaCommented:
you can use
<%= ....%> as well
0
 
koppchaCommented:
Just wondering why C Grade ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.