string seconds - part-cw/lambdanative GitHub Wiki
(string->seconds str fmt . tz0)
string->seconds converts a string with the given format into seconds.
| Parameter | Description |
|---|---|
| str | String to be converted |
| fmt | Time format string. Accepting printf % notation and SRFI-19 ~ notation |
| tz0 | Optional: Specification of the timezone |
Example
Example 1: Convert some strings to Unix epoch values
> (string->seconds "1990-01-01 0:00:00" "%Y-%m-%d %H:%M:%S")
631177225.
> (string->seconds "2001-09-09 01:46:40" "%Y-%m-%d %H:%M:%S" 0) ;; 1000000000
1000000032.
> (string->seconds "2009-02-13 23:31:30" "%Y-%m-%d %H:%M:%S" 0) ;; 1234567890
1234567924.