Link to home
Start Free TrialLog in
Avatar of joett
joett

asked on

Data format YYYY-MM-DD

Hi, I am tring to insert a date in my JSP page. But what I can do is only <%=new java.util.Date()%> which result in a long string (like Mon Mar 03 00:09:54 PST 2003).

I wonder if I can have something short like YYYY-MM-DD or DD-MM-YYYY whatever.

Many thanks.
Avatar of Mick Barry
Mick Barry
Flag of Australia image

<%
java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyy-MM-dd");
%>
<%= df.format(new java.util.Date()) %>
woops, should be:

<%
java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd");
%>
<%= df.format(new java.util.Date()) %>
Avatar of joett
joett

ASKER

Is it possible to add a week day there? like Monday, Tuesday?

thanks.
ASKER CERTIFIED SOLUTION
Avatar of thanassis
thanassis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I answer your original question, and you go and accept someone elses comment???
Avatar of joett

ASKER

hi, objects, i am sorry. i would like to spilt my points if i could. but thanasis did solved my problem.