Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package to parse dates in Common Lisp?

Tags:

common-lisp

I'm writing a simple web scraper in Common Lisp (SBCL) as a learning exercise, & would like to sort by date. To do this, I'll need to parse dates in the format "MM/DD/YYYY" into universal time.

I could simply tokenise the string & pass the bits into encode-universal-time, but I figure that there must be a built-in function (or popular third-party package) for date parsing. I'd greatly appreciate someone recommending one :-)

like image 494
Duncan Bayne Avatar asked May 02 '11 07:05

Duncan Bayne


2 Answers

This answer is very late but the local-time library is featureful and widely used. It is based on the article The long painful history of time.

It supports :

  1. Time and date arithmetic
  2. ISO 8601 timestring formatted output and parsing
  3. Reader macros to embed timestrings directly in code
  4. Timezone handling (will read unix tzfile format)
  5. Conversion between universal and unix time epochs
  6. Julian date calculation
like image 146
mcheema Avatar answered Nov 08 '22 22:11

mcheema


See the net-telent-date and simple-date-time libraries for Common Lisp. The former has a parse-time function you can use (see parse-time.lisp). Both are included in the QuickLisp library collection.

like image 42
Terje Norderhaug Avatar answered Nov 08 '22 21:11

Terje Norderhaug