×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Need day of month function (1="first", 2="second", 16="

Need day of month function (1="first", 2="second", 16="

Need day of month function (1="first", 2="second", 16="

(OP)
Hi All,
I need some ideas on how to convert the day of month to words like this:

Day of Month      Word
------------      --------------
1                 first
2                 second
...
16                sixteenth
30                thirtieth
---------------------------------

Should I consider a 31-element array like this?:
["first","second","third"...]

Then index the array with the day of the month?

What do you think?

-Jeff

RE: Need day of month function (1="first", 2="second", 16="

(OP)
Well,
For now I've solved my own problem. If anyone has a better (i.e. more efficient) way of doing this, I would be happy to hear it.

stringvar array numbers:=["first","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth","twentieth","twenty-first","twenty-second","twenty-third","twenty-fourth","twenty-fifth","twenty-sixth","twenty-seventh","twenty-eighth","twenty-ninth","thirtieth","thirty-first"];
numbers[Day(today())]

-Jeff

RE: Need day of month function (1="first", 2="second", 16="

If you want cardinal numbers, you can use ToWords(11,0), which returns "eleven".
There is no function for ordinal numbers though - making an array (like you have done) is probably the simplest way to do this.

Malcolm

RE: Need day of month function (1="first", 2="second", 16="

(OP)
Cool! I did not think about the ToWords() function. I'll have to remember that. Also, thanks for the terminology: "ordinal" and "cardinal". I could not think of the right words to explain it.

-Jeff

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close