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
2009-09-16 16:10:52
Thanks! Worked like a charm.
Megaduck
2009-09-17 02:39:43
And the reverse: java.util.Date.new(Time.now.to_i*1000)
Erlend Halvorsen
2010-01-30 16:11:48