Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Date Formating  RSS feed

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i will be given number(only day no month and year) between 01 and 31 , i want to format the number in such a way that

if it is "1" i have to display it as "1st"
if it is "2" i have to display it as "2nd"
if it is "3" i have to display it as "3rd"
..
..
..
if it is "31" i have to display it as "31st"

is there any date utility which does this function directly.
 
Marshal
Posts: 59404
187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't come across a utility which automatically changes 1 to 1st, I am afraid.
Whenever I wanted to do that, I have had to do it the hard way.

CR
 
I AM MIGHTY! Especially when I hold this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!