Skip to content

Instantly share code, notes, and snippets.

@slackorama
Created October 5, 2010 23:35
Show Gist options
  • Save slackorama/612547 to your computer and use it in GitHub Desktop.
Save slackorama/612547 to your computer and use it in GitHub Desktop.
;;;==========================================================================
;;; 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