Javascript's getTime()
method returns the number of milliseconds since midnight of January 1, 1970.
How do I convert the output of getTime()
to a Ruby Time object?
datetimejavascriptrubyruby-on-rails
Javascript's getTime()
method returns the number of milliseconds since midnight of January 1, 1970.
How do I convert the output of getTime()
to a Ruby Time object?
Best Answer
You can use the Time.at method, and divide the JavaScript timestamp value by 1000, since the at method, uses seconds instead of milliseconds, for example: