Posted By

iloveitaly on 06/05/09


Tagged

get month day suffix


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

BrianCoyDesign


Get Day Suffix


 / Published in: PHP
 

  1. function getDaySuffix($day) {
  2. switch($day) {
  3. case 1:
  4. return 'st';
  5. case 2:
  6. return 'nd';
  7. case 3:
  8. return 'rd';
  9. default:
  10. return 'th';
  11. }
  12. }
  13.  
  14. // ex:
  15. $dayNumber = 1;
  16. echo $dayNumber.' '.getDaySuffix($dayNumber).' of July';

Report this snippet  

You need to login to post a comment.