?
Solved

Data format YYYY-MM-DD

Posted on 2003-03-02
6
Medium Priority
?
646 Views
Last Modified: 2006-11-17
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.
0
Comment
Question by:joett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 92

Expert Comment

by:objects
ID: 8054136
<%
java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyy-MM-dd");
%>
<%= df.format(new java.util.Date()) %>
0
 
LVL 92

Expert Comment

by:objects
ID: 8054141
woops, should be:

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

Author Comment

by:joett
ID: 8056310
Is it possible to add a week day there? like Monday, Tuesday?

thanks.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 4

Accepted Solution

by:
thanassis earned 150 total points
ID: 8056632
try this:
<%
java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("EEE, MMM d, yyyy");
%>
<%= df.format(new java.util.Date()) %>


0
 
LVL 92

Expert Comment

by:objects
ID: 8060802
I answer your original question, and you go and accept someone elses comment???
0
 

Author Comment

by:joett
ID: 8066769
hi, objects, i am sorry. i would like to spilt my points if i could. but thanasis did solved my problem.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
The top devops trends for 2017 are focused on improved deployment frequency, decreased lead time for change and decreased MTTR.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question