tags:

views:

328

answers:

1

Using JRuby, is there a good way to convert a Java Date object into a JRuby Time object? I'm using the latest version of JRuby (1.3.1) and Java SE 6.

+8  A: 

This should work fine:

Time.at(java.util.Date.new.getTime/1000)
Nick Sieger
Thanks! Worked like a charm.
Megaduck
And the reverse: java.util.Date.new(Time.now.to_i*1000)
Erlend Halvorsen