Created
December 10, 2014 10:35
-
-
Save ykarikos/7fa5dbbbe69ad8ed68a8 to your computer and use it in GitHub Desktop.
Calculate timezone difference between two dates
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
(defn get-timezone-delta [dateformat utc-time-string local-time-string] | |
(let [utc-time (f/parse dateformat utc-time-string) | |
local-time (f/parse dateformat local-time-string) | |
abs-delta (t/in-hours (t/interval (t/earliest utc-time local-time) (t/latest utc-time local-time)))] | |
(if (t/after? utc-time local-time) | |
(- abs-delta) | |
abs-delta))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment