Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.text.SimpleDateFormat -- formatting my date

807603Nov 4 2007 — edited Nov 6 2007
Hello,

I want to generate a date in following format;

"Dec, 5th 2007" or "Dec, 1st 2007" or "Dec, 3rd 2007"

So far, I have,

SimpleDateFormat sdf = new SimpleDateFormat ( "MMM, dd yyyy" );
return sdf.format ( new Date () );

but I have not been able to get day of month in the "th", "rd", "st" format.

Anyone know how to do this?

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 4 2007
Added on Nov 4 2007
6 comments
2,032 views