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 47
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 : HTML to XML ---> get title & description
Ask a Rails expert : Accessing controller actions from scripted page?
Ask a Rails expert : seledted option for select_tag
Ask a Rails expert : Merging fields from two tables into one, including duplicates
Ask a Rails expert : saving has_many :through
Ask a Rails expert : Use Rails to develop sites for both Designer and Programmer
Ask a Rails expert : Rails+RS232
Ask a Rails expert : Is this a good way to add Admin section
Ask a Rails expert : RSS feed maker in rails 2.1
Ask a Rails expert : Syncing with ugly legacy databases