Thread
:
Add ST/ND/RD/TH to DAY in DATE
View Single Post
10-20-2005, 11:32 PM
PM User
|
#
29
felgall
Master Coder
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,465
Thanks: 0
Thanked 499 Times in 491 Posts
What about this to test the values in the easiest to follow way:
switch (aNum) {
case 1:
case 21:
case 31:
suffix = 'st';
break;
case 2:
case 22:
suffix = 'nd';
break;
case 3:
case 23:
suffix = 'rd';
break;
default:
suffix = 'th';
}
__________________
Stephen
Learn Modern JavaScript -
http://javascriptexample.net/
Helping others to solve their computer problem at
http://www.felgall.com/
felgall
View Public Profile
Visit felgall's homepage!
Find More Posts by felgall