The (n)th day of (Month), (Year)

Joe_MathisJoe_Mathis Member Posts: 173
edited 2006-10-17 in NAV Tips & Tricks
The (n)th day of (Month), (Year).

I needed to show the date in this format for a report.
Variables
txtDay            Text(30)
txtMonthYear      Text(30)

txtDay := FORMAT(TODAY,0,'<Day>');
txtMonthYear := FORMAT(TODAY,0,'<Month Text>, <Year4>');

CASE txtDay OF
  '1','21','31' : txtDay := STRSUBSTNO('%1st',txtDay);
  '2','22' : txtDay := STRSUBSTNO('%1nd',txtDay);
  '3','23' : txtDay := STRSUBSTNO('%1rd',txtDay);
  ELSE txtDay := STRSUBSTNO('%1th',txtDay);
END;

MESSAGE('%1 day of %2.',txtDay,txtMonthYear);

Simple enough right?
Sign In or Register to comment.