I want to convert a time specified with a TZ datababse timezone such as
America/Caracas into a UTC date-time but I can only find in clj-time
from-time-zone and to-time-zone allowing the zone to be specified as a
string. I want:
(t/some-utc-func (t/date-time 1967 7 31 6 30) (t/time-zone-for-id
This is not quite to your exact specification, but should help you to write
what you want:
user (defn to-utc [dt]
(t/to-time-zone dt (t/time-zone-for-offset 0)))
#'user/to-utc
user (to-utc (t/from-time-zone (t/date-time 1967 7 31 6 30)
(t/time-zone-for-id America/Caracas)))
#DateTime
On 14/06/2014 16:12, Stephen Gilardi wrote:
This is not quite to your exact specification, but should help you to
write what you want:
user (defn to-utc [dt]
(t/to-time-zone dt (t/time-zone-for-offset 0)))
#'user/to-utc
user (to-utc (t/from-time-zone (t/date-time 1967 7 31 6 30)
You're welcome.
As another small refinement, I noticed that there's a var for the utc timezone:
(t/time-zone-for-offset 0)
can be replaced with
t/utc
--Steve
On Jun 14, 2014, at 12:49 PM, gvim gvi...@gmail.com wrote:
On 14/06/2014 16:12, Stephen Gilardi wrote:
This is not
On 14/06/2014 17:59, Stephen Gilardi wrote:
You're welcome.
As another small refinement, I noticed that there's a var for the utc
timezone:
(t/time-zone-for-offset 0)
can be replaced with
t/utc
I tried t/utc in place of your function but it didn't produce the
desired result.
gvim
--
2014-06-14 20:49 GMT+04:00 gvim gvi...@gmail.com:
Can't think why it's not baked into the library, though, as it must be a
common requirement.
Feel free to submit a pull request and a few tests. The clj-time
maintainers are responsive
and the library is primarily driven by user feedback at
On 14/06/2014 21:59, Michael Klishin wrote:
2014-06-14 20:49 GMT+04:00 gvim gvi...@gmail.com
mailto:gvi...@gmail.com:
Can't think why it's not baked into the library, though, as it must
be a common requirement.
Feel free to submit a pull request and a few tests. The clj-time