From The Compiler, 6 Years ago, written in Bash.
Embed
  1. #!/bin/bash
  2. day=$(date '+%d')
  3.  
  4. if [[ $day == 11 || $day == 12 || $day == 13 ]]; then
  5.         suffix=th
  6. elif [[ ${day:1:1} == 1 ]]; then
  7.         suffix=st
  8. elif [[ ${day:1:1} == 2 ]]; then
  9.         suffix=nd
  10. elif [[ ${day:1:1} == 3 ]]; then
  11.         suffix=rd
  12. else
  13.         suffix=th
  14. fi
  15.  
  16. date "+%e$suffix of %B %Y"