Skip to content

Commit

Permalink
add format-only-date
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinmera committed Jun 20, 2024
1 parent 53f0926 commit 4ef7622
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions module.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@
#:format-machine-date
#:format-human-date
#:format-fancy-date
#:format-only-date
#:format-time
#:parse-time
#:make-random-string
Expand Down
6 changes: 6 additions & 0 deletions toolkit.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
stream stamp :format '(:long-weekday ", " :ordinal-day " of " :long-month " " :year ", " :hour ":" (:min 2) ":" (:sec 2) " UTC")
:timezone local-time:+utc-zone+))

(defun format-only-date (stamp &optional stream)
(when (integerp stamp) (setf stamp (local-time:universal-to-timestamp stamp)))
(local-time:format-timestring
stream stamp :format '((:year 4) "-" (:month 2) "-" (:day 2))
:timezone local-time:+utc-zone+))

(defun format-time (stamp &optional (relative-time-threshold (* 60 60 24)) stream)
(when (typep stamp 'local-time:timestamp)
(setf stamp (local-time:timestamp-to-universal stamp)))
Expand Down

0 comments on commit 4ef7622

Please sign in to comment.