(import (chicken condition) (srfi 19)) (define (try-pattern input pattern) (call/cc (lambda (k) (with-exception-handler (lambda (x) (k #f)) (string->date input pattern))))) (define (parse-timestamp timestamp) (or (try-pattern timestamp "~H:~M:~S") (try-pattern timestamp "~Y-~m-~e") (try-pattern timestamp "~Y-~m-~e ~H:~M:~S"))) (parse-timestamp "2022-10-14")