1

I have a timestamp string "2011-01-23T16:18:46-08:00" and I want to convert it to my local time zone.

(format-time-string  
    "%Y-%m-%dT%H:%M:%S%z" 
    (decode-time (parse-iso8601-time-string "2011-01-23T16:18:46-08:00")))

gives

"1970-02-04T13:24:34-0800"

which is off by several decades. How do I fix this?

3

parse-iso8601-time-string already returns a time value that format-time-string accepts:

(format-time-string
 "%Y-%m-%dT%H:%M:%S%z"
 (parse-iso8601-time-string "2011-01-23T16:18:46-08:00"))
     => "2011-01-24T08:18:46+0800"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.