Created
October 5, 2010 23:35
-
-
Save slackorama/612547 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;========================================================================== | |
;;; DATE MADNESS | |
;;;========================================================================== | |
;;; from ejacs...a whole other type of madness | |
(defun js-date-js-to-elisp (time) | |
"Turn a JavaScript ms TIME value into (high low . ignored) | |
`high' is the most signifcant 16 bits; `low' is the 16 lsb." | |
(let ((sec (/ time 1000.0))) | |
(list (truncate (/ sec 65536)) ; high 16 bits of sec | |
(truncate (mod sec 65536)) ; low 16 bits of sec | |
(* 1000 (round (* 1000 (mod sec 1))))))) | |
;;; take seconds and convert it to UTC | |
(format-time-string "%Y%m%dT%H:%M:%S" (seconds-to-time (string-to-number | |
"1286315627")) t) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment