Date format: Difference between revisions

Content added Content deleted
(→‎{{header|Common Lisp}}: with local-time)
Line 611: Line 611:
(format t "~a, ~a ~d, ~4d~%"
(format t "~a, ~a ~d, ~4d~%"
(aref *day-names* day) (aref *month-names* month) date year))</lang>
(aref *day-names* day) (aref *month-names* month) date year))</lang>

With the local-time library:

<lang lisp>
(local-time:format-timestring nil (local-time:now) :format '(:year "-" (:month 2) "-" (:day 2)))
;; => "2019-11-13"
(local-time:format-timestring nil (local-time:now) :format '(:long-weekday ", " :long-month #\space (:day 2) ", " :year))
;; => "Wednesday, November 13, 2019"
</lang>


=={{header|Component Pascal}}==
=={{header|Component Pascal}}==