Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby Time vs Java Date millisecond interpretation
>> time = Time.new -1, 12, 31, 23, 59, 59, 0
=> -0001-12-31 23:59:59 UTC
>> time.to_f
=> -62167219201.0
>> time_millis = (time.to_f * 1000).round
=> -62167219201000
>> jdate = time.to_java
=> #<Java::JavaUtil::Date:0x5a360f2b>
>> jdate.toString
=> "Sat Jan 03 00:59:59 CET 1"
>> jdate.getTime
=> -62167219201000
>> java.text.SimpleDateFormat.new("yyyy-MM-dd HH:mm:ss").format jdate
=> "0001-01-03 00:59:59"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.