×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

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!

*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

Day & Get(Current Date) calc

Day & Get(Current Date) calc

Day & Get(Current Date) calc

(OP)
Hi group,

I'm trying to put together a calculation that examines the current day and then appends the appropriate "st", "nd" or "rd" for some legalese stuff we're doing (e.g., "This 30th day of April 2007).  Problem is, it doesn't seem to evaluate the entire string and I can't quite figure out why. When I test the calc I get a result like "30st" when it should be "30th". Can anyone see where I'm doing something wrong here:

CODE

Case (

Day ( Get ( CurrentDate ) = 1); Day ( Get ( CurrentDate )) & "st";
Day ( Get ( CurrentDate ) = 2); Day ( Get ( CurrentDate )) & "nd";
Day ( Get ( CurrentDate ) = 3); Day ( Get ( CurrentDate )) & "st";
Day ( Get ( CurrentDate ) = 4); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 5); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 6); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 7); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 8); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 9); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 10); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 11); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 12); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 13); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 14); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 15); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 16); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 17); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 18); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 19); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 20); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 21); Day ( Get ( CurrentDate )) & "st";
Day ( Get ( CurrentDate ) = 22); Day ( Get ( CurrentDate )) & "nd";
Day ( Get ( CurrentDate ) = 23); Day ( Get ( CurrentDate )) & "rd";
Day ( Get ( CurrentDate ) = 24); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 25); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 26); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 27); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 28); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 29); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 30); Day ( Get ( CurrentDate )) & "th";
Day ( Get ( CurrentDate ) = 31); Day ( Get ( CurrentDate )) & "st"

 )

The field this applies to is c_day_append, and returns a text result.  Our people are working in a mixed FileMaker 8.5 and 9 environment.
 

RE: Day & Get(Current Date) calc

Cryogen,

I notice that your formula for day 3 is incorrect.  It will return 3st where it should be 3rd.

Is this maybe your only problem?

-Striker

RE: Day & Get(Current Date) calc

(OP)
Thanks Striker.  I cross-posted this message on the FMP Technet site and got a great tip from one of the regulars there, Steve Harley.  This solves it for me:

CODE


Let (d = Day (Get (CurrentDate));
     d &
     Case (
       (d = 1) or (d = 21) or (d = 31); "st";
       (d = 2) or (d = 22); "nd";
       (d = 3) or (d = 23); "rd";
       "th"
     )
   )

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