You are here: Forums Ask a Rails expert How to convert time in mililse...
Posted in Forums : Ask a Rails expert
Authority 0
Posting Rating 45
Sign in to rate this post
|
Hi I am trying to convert time into milisecond Is there is any ruby method |
Authority 62
Posting Rating 100
Sign in to rate this post
|
Not sure, but couldn’t you just do Time.now.to_i * 1000? If so, you could always monkeypatch it into the Time class:
Time.class_eval do
def milliseconds
self.to_i * 1000
end
end
This way, you could say Time.now.milliseconds. HTH |
Authority 25
Posting Rating 0
Sign in to rate this post
|
why not use core Time class ? irb(main):001:0> require “Time” |
Authority 62
Posting Rating 100
Sign in to rate this post
|
Christian: Isn’t this the value in seconds instead of milliseconds? |
Authority 25
Posting Rating 0
Sign in to rate this post
|
clemens, so extending time or creating helpers would be it. |
Ask a Rails expert : How to work with ror 2.1.1 using Netbeans IDE 6.1
Ask a Rails expert : json gem error
Ask a Rails expert : Problem with break
Ask a Rails expert : activesupport string first method error
Ask a Rails expert : url_for broken ?
Ask a Rails expert : map.routes.rb pls help
Ask a Rails expert : how to h tag in controller
Ask a Rails expert : Problem with Restful routing and partial form
Ask a Rails expert : will_paginate, search and ajax