Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Day & Get(Current Date) calc

Status
Not open for further replies.

CryoGen

MIS
Apr 15, 2004
86
US
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.
 
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
 
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"
     )
   )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top