on 08-03-2007 1:04 PM
Hi,
I am writing a method in my Application:
//@@begin FormatDate()
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd");
Date d;
String OutDate = "";
try {
d = dateFormat.parse(InDate);
dateFormat.applyPattern("DD-MMM-YYYY");
OutDate = dateFormat.format(d);
} catch (ParseException e) {
wdComponentAPI.getMessageManager().reportWarning("Date Parse Exception");
}
return (OutDate);
//@@end
The OutDate that I get is in Format DD-MMM-YYYY but MMM is in digits instead of letters i.e. for 2007-07-31 it gives 31-007-2007 instead of 31-Jul-2007.
Any clues to get proper output??
I have tried applying format DD-MON-YYYY it too doesn't help.
Thanks
Anagha
Try this one:
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
try
{
Date birthday = df.parse("1966-09-03");
df.applyPattern("dd-MMM-yyyy");
System.out.println(df.format(birthday));
}
catch (ParseException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
See also http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ..
check this link..
Hope this will helpful for u..
Urs GS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.