Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing dates in Common Lisp

What's the proper way to store dates in Common Lisp? The closest thing I found to an answer is this, which doesn't really seem to cut it for me.

like image 267
Jason Swett Avatar asked Nov 14 '10 17:11

Jason Swett


2 Answers

How about ENCODE-UNIVERSAL-TIME?

(defparameter *my-birth-date* (encode-universal-time 0 0 0 14 2 1984))
like image 90
Ken Avatar answered Oct 14 '22 08:10

Ken


If you want to store a date converted to string, you can use the following:

(multiple-value-bind
  (s m h d mm y dw dst-p tz) (get-decoded-time)
     (format nil "~D\/~D\/~D" date month year))
like image 43
khachik Avatar answered Oct 14 '22 08:10

khachik