Browse Source

create month-number-to-name function in utils package.

This is a helper function to convert '1' to 'January', for example. The intended
use for this is to work alongside the local-time package when generating the
month number from a timestamp.
stable
Craig Oates 2 years ago
parent
commit
6389480260
  1. 19
      src/utils.lisp

19
src/utils.lisp

@ -23,7 +23,8 @@
#:create-timestamp-id
#:format-filename
#:format-keywords
#:build-alert-string)
#:build-alert-string
#:month-number-to-name)
(:documentation "Utilities that do not depend on models."))
(in-package #:utils)
@ -166,3 +167,19 @@ to operate properly."
(second minute hour day month year)
(get-decoded-time)
(format nil "~d~2,'0d~d~2,'0d~2,'0d~2,'0d" year month day hour minute second)))
(defun month-number-to-name (month-number)
"Converts `MONTHS-NUMBER' to its name (E.G. 1 to 'January')."
(cond ((= 1 month-number) "January")
((= 2 month-number) "February")
((= 3 month-number) "March")
((= 4 month-number) "April")
((= 5 month-number) "May")
((= 6 month-number) "June")
((= 7 month-number) "July")
((= 8 month-number) "August")
((= 9 month-number) "September")
((= 10 month-number) "October")
((= 11 month-number) "November")
((= 12 month-number) "December")
(t nil)))

Loading…
Cancel
Save